Core: Improve ActionBar focus indicator in high contrast mode#34779
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR changes ChangesHigh-Contrast Mode Focus Styling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/core/src/components/components/ActionBar/ActionBar.tsx`:
- Around line 59-62: The forced-colors media rule in the ActionBar component
uses the wrong system color; in the style block keyed by "@media (forced-colors:
active)" inside ActionBar.tsx replace the outline color 'CanvasText' with the
correct system color 'ButtonBorder' (keep outline and outlineOffset as-is) so
the button focus outline uses the proper forced-colors semantic color.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5df44d42-c2dc-4244-a2d3-7f0be2d56a68
📒 Files selected for processing (1)
code/core/src/components/components/ActionBar/ActionBar.tsx
1046dd8 to
9ccd4c1
Compare
What I did
Strengthened the focus outline on
ActionBarbuttons (used by the Copy button in code blocks, action items in Preview, etc.) when rendered underforced-colors: active.'@media (forced-colors: active)': { - outline: '1px solid highlight', + outline: '2px solid CanvasText', + outlineOffset: '2px', },The previous
1px solid highlightrule did render an outline, but on Windows 11 contrast themes it appears as a thin violet line that's easy to miss next to the button's existing border — failing the spirit of WCAG 2.4.7 (Focus Visible).Changes:
2pxwidth instead of1pxfor visibilityCanvasText(primary text system color) for guaranteed contrast against any HC backgroundoutline-offset: 2pxto separate the focus ring from the button border so they don't merge visuallyCanvasTextis a CSS system color defined by the OS contrast theme, so the fix adapts automatically across Night sky / Desert / Dusk / Aquatic on Windows 11 and the legacy Black/White themes from Windows 10.Fixes #22707
Manual testing
cd code && yarn storybook:uiSame applies to other consumers of
ActionBar, e.g. the additional actions in the docs Preview block.Screenshots
Tested on Windows 11 Night sky theme.
Before (

1px solid highlight): thin violet outline, easy to miss.After (

2px solid CanvasText+outline-offset: 2px): thick, well-separated focus ring.Summary by CodeRabbit