Skip to content

Commit f797e62

Browse files
committed
add wrapper element to focus even in safari/firefox in macos
1 parent 7859f79 commit f797e62

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

src/scripts/Button.tsx

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,35 @@ export class Button extends Component<ButtonProps, {}> {
108108
});
109109

110110
return (
111-
// eslint-disable-next-line react/button-has-type
112-
<button
113-
ref={(node: HTMLButtonElement) => {
114-
this.node = node;
115-
if (buttonRef) buttonRef(node);
116-
}}
117-
className={btnClassNames}
118-
type={htmlType}
119-
{...props}
120-
onClick={this.onClick}
111+
/* eslint-disable react/button-has-type */
112+
<span
113+
className='react-slds-button-focus-wrapper'
114+
style={{ outline: 0 }}
115+
tabIndex={-1}
121116
>
122-
{icon && iconAlign !== 'right'
123-
? this.renderIcon(iconSize, inverse)
124-
: null}
125-
{children || label}
126-
{icon && iconAlign === 'right'
127-
? this.renderIcon(iconSize, inverse)
128-
: null}
129-
{iconMore ? this.renderIconMore() : null}
130-
{alt ? <span className='slds-assistive-text'>{alt}</span> : null}
131-
{loading ? <Spinner /> : null}
132-
</button>
117+
<button
118+
ref={(node: HTMLButtonElement) => {
119+
this.node = node;
120+
if (buttonRef) buttonRef(node);
121+
}}
122+
className={btnClassNames}
123+
type={htmlType}
124+
{...props}
125+
onClick={this.onClick}
126+
>
127+
{icon && iconAlign !== 'right'
128+
? this.renderIcon(iconSize, inverse)
129+
: null}
130+
{children || label}
131+
{icon && iconAlign === 'right'
132+
? this.renderIcon(iconSize, inverse)
133+
: null}
134+
{iconMore ? this.renderIconMore() : null}
135+
{alt ? <span className='slds-assistive-text'>{alt}</span> : null}
136+
{loading ? <Spinner /> : null}
137+
</button>
138+
</span>
139+
/* eslint-enable react/button-has-type */
133140
);
134141
}
135142
}

0 commit comments

Comments
 (0)