Skip to content

Conversation

@JarvisInvestInsight
Copy link

@JarvisInvestInsight JarvisInvestInsight commented Feb 1, 2026

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.ts

  • focus-ring: Changed ring-fg/10 to ring-fg/50 for visible focus rings
  • Added ring-offset-bg for consistent offset coloring
  • input-base: Changed border-fg/40 to border-fg/50 and ring-fg/10 to ring-fg/30

app/assets/main.css

  • Link focus outline: Changed from var(--border) to var(--fg-muted) for better contrast

Testing

Tab through interactive elements in both light/dark mode - focus indicators are now visible.

Fixes #647


Found this helpful? ☕ Buy me a coffee

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 1, 2026 8:09pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 1, 2026 8:09pm
npmx-lunaria Ignored Ignored Feb 1, 2026 8:09pm

Request Review

@whitep4nth3r
Copy link
Collaborator

This is looking better in terms of colour contrast!

I found some areas that need the same treatment though.

Settings page:

image

A package page:

image

There are still some focussed items that don't show the full outline, for example on a package page:

image image image image

There are some others too on the package page.

The logo on in the header could do with the same treatment also.

image

- 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
@JarvisInvestInsight JarvisInvestInsight force-pushed the fix/focus-outline-contrast branch from a85c0cc to b6701f9 Compare February 1, 2026 18:40
@JarvisInvestInsight
Copy link
Author

@whitep4nth3r Thanks for the detailed review! I've pushed updates addressing the feedback:

  • Settings Toggle - Added focus ring to the switch button
  • CollapsibleSection - Added focus styles to the section header anchor links
  • Tag shortcut - Added focus-visible styles so interactive tags/badges show proper outlines

Also rebased on latest main. Let me know if there are any other elements that need attention!

@whitep4nth3r
Copy link
Collaborator

All focus rings in this top bar do not match the others, some of them are a darker grey and the first item has a blue inner ring.

image

I'd still love to see some of the items that don't have a complete focus ring addressed, like this one, and a lot of the focused items in the right sidebar.

image

Also, when some items are focussed in the right sidebar, they are only underlined and do not have a full ring. This would be nice if it was consistent.

image

The compare page input field also doesn't have the same great focus ring as the input field on the search page.

image

Keep going!

@thasmo
Copy link
Contributor

thasmo commented Feb 1, 2026

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?

Match the search page input styling with focus-visible:ring-2
@JarvisInvestInsight
Copy link
Author

@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.

@JarvisInvestInsight
Copy link
Author

@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 ring-fg/50 (foreground color at 50% opacity) which provides good contrast across different themes. Using accent would look great but might need some care to ensure enough contrast in all theme/accent combinations.

Maybe something like ring-accent/70 or mixing accent with a darker shade? What do you think would work best with the existing accent color options?

@whitep4nth3r
Copy link
Collaborator

Thanks for looking into everything!

I would go with full focus rings throughout.

@JarvisInvestInsight
Copy link
Author

Perfect, full rings it is! I'll work through the remaining elements and push an update.

- 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
@JarvisInvestInsight
Copy link
Author

Pushed a bigger update that standardizes focus rings across the codebase:

Fixed:

  • Header nav links (Compare, Settings) - removed conflicting inline styles, now use link-subtle shortcut properly
  • Header search input - consistent ring-fg/50 with offset
  • Home page search input - same treatment
  • Mobile menu button - uses focus-ring shortcut
  • Compare page inputs (search + remove buttons)
  • Connector modal inputs
  • Translation helper links

The issue was some components were using ring-accent/50 while the focus-ring shortcut uses ring-fg/50 - now they should all match.

Still need to look at the version selector clipping issue, will dig into that next.

Was using undefined 'ring-ring' color, now uses consistent focus-ring shortcut
@thasmo
Copy link
Contributor

thasmo commented Feb 1, 2026

Maybe something like ring-accent/70 or mixing accent with a darker shade? What do you think would work best with the existing accent color options?

@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. 🙂

@JarvisInvestInsight
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focus outlines are not consistent and fail colour contrast

3 participants