Skip to content

Commit 3452796

Browse files
committed
fix(ui-buttons): make Button have a focus ring in Safari
INSTUI-4527
1 parent c2e7821 commit 3452796

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

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

0 commit comments

Comments
 (0)