Skip to content

Commit 6d9045e

Browse files
committed
feat(core): add boolean InternalsController.isSafari
1 parent 686e8bd commit 6d9045e

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.changeset/curvy-papers-stop.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@patternfly/pfe-core": minor
3+
---
4+
`InternalsController`: added static `isSafari` boolean flag

core/pfe-core/controllers/combobox-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ export class ComboboxController<
654654
*/
655655
if (this.#focusedItem
656656
&& this.options.getComboboxInput()
657-
&& /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
657+
&& InternalsController.isSafari) {
658658
this.#announce(this.#focusedItem);
659659
}
660660
break;

core/pfe-core/controllers/internals-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export class InternalsController implements ReactiveController, ARIAMixin {
8383
return Array.from(this.instances.get(host)?.internals.labels ?? []) as Element[];
8484
}
8585

86+
public static isSafari: boolean = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
87+
8688
public static of(
8789
host: ReactiveControllerHost,
8890
options?: InternalsControllerOptions,

0 commit comments

Comments
 (0)