Skip to content

Commit 395867f

Browse files
authored
[Fix Accessibility] Add focus-visible styles to Clipboard Copy button (#1716)
### Add focus-visible styles to clipboard copy button for improved accessibility - **Files Changed** code.js - **Summary** This change adds proper focus-visible styling to the clipboard copy button, providing a clear visual indicator when users navigate to the button using keyboard controls while maintaining system-consistent focus ring colors for better accessibility compliance. ## BEFORE <img width="878" height="228" alt="image" src="https://github.com/user-attachments/assets/a7c21e39-9003-4f63-9df7-071e17b1d763" /> ## AFTER <img width="851" height="232" alt="image" src="https://github.com/user-attachments/assets/e59dede0-4dee-4d19-875b-60af30d3dac6" />
1 parent c2ae6b5 commit 395867f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mdx/code.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ const ClipboardCopy = ({value, ...props}) => {
3131
setCopied(true)
3232
announce(`Copied to clipboard`)
3333
}}
34+
sx={{
35+
...props.sx,
36+
'&:focus-visible': {
37+
outline: '2px solid',
38+
outlineColor: '-webkit-focus-ring-color',
39+
outlineOffset: '2px',
40+
},
41+
}}
3442
>
3543
<Octicon icon={copied ? CheckIcon : CopyIcon} sx={{color: copied ? 'success.fg' : 'fg.muted'}} />
3644
</Button>

0 commit comments

Comments
 (0)