Repository navigation
fix(web): keep the ring border on focused overlays - #59
Merged
Merged
Conversation
The site-wide "no focus ring" rule zeroes --tw-ring-shadow on any focused element. Card was excluded for this in September, because its ring-1 is the border, not a focus ring. Overlay shells are the same case and were missed: menus, popovers, selects, comboboxes and dialogs have no border — bg-popover plus ring-1 is their edge — and Base UI hands focus to the shell when it opens (dropdown-menu-content carries tabindex="-1"). The edge vanished the moment they opened, leaving a white panel on the white page with only a faint shadow: the top-bar avatar menu looked like a line of text floating under the header. Excluding container surfaces by their naming convention (data-slot ending in -content) keeps the decision in one place and stops the next overlay from regressing the same way. Form controls still lose the focus ring.
4 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What this PR does and why
The site-wide no-focus-ring rule in
web/packages/ui/styles/base.csszeroes--tw-ring-shadowon any focused element.[data-slot='card']was excluded because a card'sring-1is its border, not a focus ring. Overlay shells are the same case and were missed: menus, popovers, selects, comboboxes and dialogs have noborder—bg-popover+ring-1 ring-foreground/10is their edge — and Base UI moves focus to the shell when it opens (dropdown-menu-contentcarriestabindex="-1"). So the edge was wiped exactly while the panel was on screen: a white panel on the white page kept only a faint shadow, and the top-bar avatar menu read as a line of text floating under the header.The exclusion now covers container surfaces by their naming convention (
data-slotending in-content) next tocard, so a new overlay cannot regress the same way. Nothing else changes: form controls still get their focus ring suppressed (that is the deliberate decision this rule exists for), andcardbehaves as before.Which issue(s) this PR fixes
Fixes #58
How it was tested
web/:npm run typecheck,npm test(272 passed, 31 files),vite build— all on this branch.--tw-ring-shadow: 0 0 #0000whiledocument.activeElementis the popup;--tw-ring-shadow: 0 0 0 1px <--tw-ring-color>andbox-shadowcontainsoklab(0.145 0 0 / 0.1) 0 0 0 1px, with the popup rect unchanged (128×32at the same position).<input class="ring-2 ring-ring">still computes--tw-ring-shadow: 0 0 #0000, and a[data-slot='card']withring-2still computes0 0 0 2px— both unchanged.Checks
go test ./...andgofmt -l .is emptynpm run typecheck && npm test && npm run buildinweb/(ifweb/changed)helm lint --strict helm/console(if the chart changed)Notes for reviewers
One file of CSS plus a CHANGELOG line. The
*-contentsuffix is the design-system convention for an overlay shell (dropdown-menu-content,popover-content,select-content,combobox-content,dialog-content,alert-dialog-content,dropdown-menu-sub-content);tabs-content/tooltip-content/empty-contentcome along for the ride, which is harmless — no form control ends in-content.The
focus-visible:ring-2onResourceTablerows stays suppressed by this rule as it is today; if rows should show a focus ring again, that is a separate decision (the rule is the site-wide "no focus ring" call, WCAG 2.4.7 traded deliberately).Release note