fix(a11y): improve focus outline contrast for keyboard navigation#650
fix(a11y): improve focus outline contrast for keyboard navigation#650JarvisInvestInsight wants to merge 6 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
a85c0cc to
b6701f9
Compare
|
@whitep4nth3r Thanks for the detailed review! I've pushed updates addressing the feedback:
Also rebased on latest main. Let me know if there are any other elements that need attention! |
|
Wondering; could the accent color be used as the base color for setting the outline color, possibly mixing it, to make it darker/lighter if needed? |
|
@whitep4nth3r Good catches! Just pushed a fix for the compare page input field - it was missing the focus ring entirely. For the top bar inconsistencies, I think you're right that there's some mixing of styles. I'll dig into that - looks like some elements might be using browser defaults or conflicting focus classes. The partial/clipped focus rings (like on the version selector) are interesting - I suspect it's an overflow issue where the parent container clips the ring. I'll investigate. Quick question on the sidebar links: would you prefer they all have full focus rings, or is the underline acceptable for inline text links? Happy to make them consistent either way - just want to check if there's a preferred pattern for the project. |
|
@thasmo That's an interesting idea! Using the accent color could make the focus rings feel more intentional and integrated with the design system. Currently I'm using Maybe something like |
|
Thanks for looking into everything! I would go with full focus rings throughout. |
|
Perfect, full rings it is! I'll work through the remaining elements and push an update. |
|
Pushed a bigger update that standardizes focus rings across the codebase: Fixed:
The issue was some components were using Still need to look at the version selector clipping issue, will dig into that next. |
@JarvisInvestInsight, I guess it might not be so easy to just use the same opacity/formula for all existing colors, so I don't have an answer for that. 😅 I think you're doing a great job by fixing the focus/outline issues, and maybe we can bring the topic to the a11y channel in Discord. There are already some ideas about font settings as well etc. Maybe also a high-contrast mode would make sense, but I'm no A11Y expert by all means. But maybe we can throw some requirements together and revamp the settings/colors along the way without bloating the scope too much. 🙂 |
|
Agreed, let's keep this PR focused on the focus ring fixes. Happy to jump into the a11y channel on Discord to discuss fonts, high-contrast mode, and other improvements - sounds like a good opportunity to scope out a broader a11y roadmap for the project. |
- Increase focus ring opacity from 10% to 50% in focus-ring shortcut - Add ring-offset-bg for consistent offset coloring - Update input-base focus states (border-fg/50, ring-fg/30) for better visibility - Change link focus outline from var(--border) to var(--fg-muted) for WCAG compliance Fixes npmx-dev#647
- Settings Toggle: add focus-visible ring styles to switch button - CollapsibleSection: add focus styles to anchor link heading - tag shortcut: add focus-visible styles for interactive tags/badges
Match the search page input styling with focus-visible:ring-2
- Remove inconsistent ring-accent/50 styles, use ring-fg/50 everywhere - Add ring-offset for proper spacing on inputs - Use focus-ring shortcut consistently for buttons/links - Fix header nav links, search inputs, mobile menu, modals
Was using undefined 'ring-ring' color, now uses consistent focus-ring shortcut
4edcb3c to
7d195f6
Compare
- Change sidebar container from overflow-hidden to overflow-clip to prevent focus ring clipping - Add full focus rings to section header anchor links (#keywords, #compatibility, #get-started, #readme)
|
Pushed another update addressing the clipping issues: Fixed:
The \overflow-clip\ approach is cleaner than adding inset rings or padding, as it keeps the existing layout while just fixing the focus ring clipping. Still investigating the version selector focus ring clipping - that might need a different approach since it's inside a dropdown. |
|
I'm still seeing a lot of clipping on both halves of the layout on the package page. |
|
@JarvisInvestInsight, be aware of #626. Feel free to align with @jellydeck for the accent focus-color improvements. 👍 |
|
Closing to focus on #626 |
as per dicussion from npmx-dev#650 by @JarvisInvestInsight Co-Authored-By: J.A.R.V.I.S. <258503261+JarvisInvestInsight@users.noreply.github.com>











Summary
This PR fixes the focus outline contrast issues reported in #647. Keyboard users couldn't see focus indicators due to very low opacity values.
Changes
uno.config.tsfocus-ring: Changedring-fg/10toring-fg/50for visible focus ringsring-offset-bgfor consistent offset coloringinput-base: Changedborder-fg/40toborder-fg/50andring-fg/10toring-fg/30app/assets/main.cssvar(--border)tovar(--fg-muted)for better contrastTesting
Tab through interactive elements in both light/dark mode - focus indicators are now visible.
Fixes #647
Found this helpful? ☕ Buy me a coffee