Skip to content

Commit c60e58d

Browse files
authored
fix(Button): set a tabIndex so that Safari allows focusing buttons (#2440)
1 parent 77143ab commit c60e58d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/Button/Button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,15 @@ const _Button = React.forwardRef(function Button<T extends ButtonCustomElementTy
149149
rest.className,
150150
),
151151
'data-qa': qa,
152+
// Always set a tabIndex so that Safari allows focusing native buttons
153+
tabIndex: rest.tabIndex ?? extraProps?.tabIndex ?? (disabled ? undefined : 0),
152154
};
153155

154156
if (isButtonComponentProps(props)) {
155157
return React.createElement(
156158
props.component,
157159
{
160+
role: 'button',
158161
...rest,
159162
...extraProps,
160163
...commonProps,

0 commit comments

Comments
 (0)