Skip to content

Commit 54118ac

Browse files
committed
fix(ui-buttons): make Button have a focus ring in Safari
INSTUI-4527
1 parent 7c9d7ba commit 54118ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/ui-buttons/src/BaseButton/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { isActiveElement } from '@instructure/ui-dom-utils'
3636
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
3737
import { View } from '@instructure/ui-view'
3838
import type { ViewProps } from '@instructure/ui-view'
39+
import { isSafari } from '@instructure/ui-utils'
3940

4041
import { withStyle } from '@instructure/emotion'
4142

@@ -279,7 +280,8 @@ class BaseButton extends Component<BaseButtonProps> {
279280
}
280281
}
281282
let tabIndexValue = tabIndex
282-
if (onClick && as && needsZeroTabIndex) {
283+
// In Safari, a button cannot get focus unless it has an explicit 0 tabindex
284+
if ((onClick && as && needsZeroTabIndex) || (isSafari() && as)) {
283285
tabIndexValue = tabIndex || 0
284286
}
285287
return (

0 commit comments

Comments
 (0)