Skip to content

Commit 7a90177

Browse files
authored
Merge pull request #387 from mashmatrix/fix-safari-focus
Fix to prevent moving out the focus of the control even in safari/firefox in macos
2 parents f59a1ac + acca0f8 commit 7a90177

File tree

2 files changed

+1073
-629
lines changed

2 files changed

+1073
-629
lines changed

src/scripts/Button.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class Button extends Component<ButtonProps, {}> {
107107
/^(x-small|small)$/.test(size || '') && /^icon-/.test(type || ''),
108108
});
109109

110-
return (
110+
const buttonContent = (
111111
// eslint-disable-next-line react/button-has-type
112112
<button
113113
ref={(node: HTMLButtonElement) => {
@@ -131,6 +131,20 @@ export class Button extends Component<ButtonProps, {}> {
131131
{loading ? <Spinner /> : null}
132132
</button>
133133
);
134+
135+
if (props.tabIndex != null) {
136+
return (
137+
<span
138+
className='react-slds-button-focus-wrapper'
139+
style={{ outline: 0 }}
140+
tabIndex={-1}
141+
>
142+
{buttonContent}
143+
</span>
144+
);
145+
}
146+
147+
return buttonContent;
134148
}
135149
}
136150

0 commit comments

Comments
 (0)