@leanix/components 0.3.131 → 0.3.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/forms-ui/components/picker/picker-trigger.directive.mjs +13 -3
- package/fesm2015/leanix-components.mjs +11 -1
- package/fesm2015/leanix-components.mjs.map +1 -1
- package/fesm2020/leanix-components.mjs +11 -1
- package/fesm2020/leanix-components.mjs.map +1 -1
- package/lib/forms-ui/components/picker/picker-trigger.directive.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4803,8 +4803,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImpor
|
|
|
4803
4803
|
class PickerTriggerDirective {
|
|
4804
4804
|
constructor(element) {
|
|
4805
4805
|
this.element = element;
|
|
4806
|
+
this.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
4807
|
+
this.HOST_ELEMENT_IS_BUTTON = this.element.nativeElement.matches('button');
|
|
4806
4808
|
this.focused = false;
|
|
4807
|
-
this.allClickEvents$ = fromEvent(this.element.nativeElement, 'click')
|
|
4809
|
+
this.allClickEvents$ = fromEvent(this.element.nativeElement, 'click').pipe(tap(() => {
|
|
4810
|
+
// There is an inconsistent behavior among browsers when it comes to focusing buttons on click.
|
|
4811
|
+
// Safari does not focus buttons on click, but most other browsers do. Therefore, we have to
|
|
4812
|
+
// introduce this hack to make sure that the button is focused when the user clicks it.
|
|
4813
|
+
// More details in this interesting article: https://zellwk.com/blog/inconsistent-button-behavior/
|
|
4814
|
+
if (this.IS_SAFARI && this.HOST_ELEMENT_IS_BUTTON) {
|
|
4815
|
+
this.element.nativeElement.focus();
|
|
4816
|
+
}
|
|
4817
|
+
}));
|
|
4808
4818
|
this.focusEvent$ = fromEvent(this.element.nativeElement, 'focus');
|
|
4809
4819
|
this.blurEvent$ = fromEvent(this.element.nativeElement, 'blur');
|
|
4810
4820
|
this.clickEvent$ = this.allClickEvents$.pipe(filter(() => this.focused === true));
|