Repository navigation
Fix doubled focus rings in dialogs and dropdowns - #2476
Conversation
dialog-content.svelte and four dropdown-menu components used outline-hidden, a Tailwind v4-only class. This project pins tailwindcss ^3.4.17, where outline-hidden compiles to nothing, so the browser's default focus outline was never suppressed and rendered underneath the component's own ring-2. Replaced with outline-none, the v3 equivalent, in all five affected files. Also: - Removed ring-offset-2 (and the now-unused ring-offset-background) from the dialog close button. On a borderless size-4 icon button, the offset gap made the ring read as a floating box rather than a focus halo around the icon; tabs-trigger and switch keep their offset since they wrap filled/bordered controls where it reads correctly. - Resolved the --ring token contradiction in DESIGN.md: the doc's prose said focus rings are primary (teal), but --ring was defined as neutral grey. Grey also fails WCAG 1.4.11 non-text contrast (2.58:1) against a white background in light mode; teal clears it in both modes (3.68:1 light, 6.99:1 dark). Changed --ring/dark --ring in app.css to match --primary, and updated DESIGN.md's ring token values and Input spec to match (companion commit in nodespace-docs). Verified with keyboard Tab navigation (not mouse) in both light and dark mode: the dialog close button and dropdown menu items now show exactly one focus indicator. tabs-trigger.svelte and switch.svelte were reviewed per the issue and already use outline-none correctly — no changes needed there. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
7cdaf8e to
63f3518
Compare
Code Review SummaryThis is a net-positive, well-scoped fix. It correctly diagnoses and resolves a real Tailwind v3/v4 class-mismatch bug ( Correction to this review's original brief: issue #2469 is not about Requirements CheckAgainst #2454's acceptance criteria:
All six acceptance criteria are met. The issue's proposed fix also explicitly suggested reviewing whether FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
WCAG Contrast VerificationMethodology: standard WCAG relative-luminance formula (sRGB → linearize → relative luminance → contrast ratio = (L1+0.05)/(L2+0.05)), computed from the actual HSL values in
Confirmed: the PR's light-mode numbers are accurate (2.584:1 computed vs. 2.58:1 claimed) and the core claim — grey fails 3:1 in light mode, teal clears it in both modes — is correct. RecommendationAPPROVE — with a request to (a) correct the PR description's framing of the dark-mode change as a contrast fix (light mode was the actual failure, dark mode was already compliant), and (b) file the follow-up issue for the disclosed |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
…s review) pragmatic-code-review on PR #2476 flagged that this PR's own description disclosed a second Tailwind v4/v3 mismatch in two of the same five files it touches: dropdown-menu-item.svelte and dropdown-menu-sub-trigger.svelte used the bare v4 boolean-data-attribute shorthand `data-highlighted:`, which compiles to nothing under this project's pinned Tailwind v3 without bracket syntax. That silently dropped the highlight background on hover/ keyboard-navigated dropdown items. Since this is the identical root cause (v4 class syntax on a v3 project) in the exact same two files already being touched for the doubled-ring fix, fixed it inline here rather than filing a separate follow-up issue. Converted every bare `data-highlighted:` occurrence in both files -- including the ones chained after `data-[variant=destructive]:` -- to `data-[highlighted]:`, matching the bracket syntax already used correctly elsewhere (e.g. select-item.svelte). Confirmed via grep that no bare `data-highlighted:` remains anywhere under packages/desktop-app/src/lib/components/ui/. bun run test: 233 files / 4909 tests passed. bun run quality:fix: 0 ESLint errors/warnings, tsc clean, cargo fmt + clippy -D warnings clean. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
Summary
dialog-content.svelteand fourdropdown-menucomponents usedoutline-hidden, a Tailwind v4-only class. This project pinstailwindcss ^3.4.17, whereoutline-hiddencompiles to nothing, so the browser's default focus outline was never suppressed and rendered underneath the component's ownring-2— the "doubled ring" bug. Replaced withoutline-none, the v3 equivalent, in all five affected files (grepconfirms no otheroutline-hiddenremains underpackages/desktop-app/src/lib/components/ui/).ring-offset-2(and the now-unusedring-offset-background) from the dialog close button. On a borderlesssize-4icon button, the 2px offset gap made the ring read as a floating box rather than a focus halo around the icon. Lefttabs-triggerandswitchuntouched — both already useoutline-nonecorrectly, and their offset reads fine because they wrap filled/bordered controls.--ringcontradiction inDESIGN.md(companion commit already pushed tonodespace-docsmain, since that repo commits docs changes straight to main): the doc's prose (Colors section, Do's list) said focus rings areprimary(teal), but the--ringtoken itself was neutral grey. Went with teal, for two reasons: (1) it's what the doc already said in two places — the token was the outlier; (2) in light mode, grey failed WCAG 1.4.11 non-text contrast (2.58:1 against white, need 3:1) while teal clears it (3.68:1) — a genuine accessibility fix. Dark mode's grey ring already passed 1.4.11 (3.78:1 against the dark background), so recoloring it to teal (6.99:1) there is a token/documentation consistency change, not a contrast fix — it aligns dark mode with the same--primary-derived ring the doc specifies, rather than correcting a failure. Updated--ring/dark--ringinapp.cssto match--primary, and updatedDESIGN.md's ring token values and Input spec to agree.Verification
Started the dev server and drove it with Playwright, using keyboard Tab navigation (not mouse clicks, since several of these only show on
:focusnot:focus-visible):outline-coloris fully transparent and exactly one ring renders (box-shadow: ... rgb(29, 149, 137) 0px 0px 0px 2pxin light mode,rgb(52, 157, 145)in dark mode — both match the new teal--ringtoken). Screenshots confirm a single clean ring in both light and dark mode, no nested-box artifact.outline-coloris transparent and there's no straybox-shadowring on highlighted items (these rely on background highlighting, not a ring, for their focus state).Note: while verifying dropdown items, found that
dropdown-menu-item.svelteanddropdown-menu-sub-trigger.svelteuseddata-highlighted:bg-accent— Tailwind v4's bare boolean-data-attribute variant shorthand, which doesn't exist in v3 without bracket syntax. This meant the highlight background silently didn't render on those two files (same v3/v4 mismatch class of bug as this issue, but a distinct symptom — no doubled ring, just a missing highlight). Since this is the identical root cause in the same two files already touched here, fixed it inline rather than filing a separate issue: converted all baredata-highlighted:occurrences (including the ones chained afterdata-[variant=destructive]:) todata-[highlighted]:in both files. Confirmed viagrepthat no baredata-highlighted:remains anywhere underpackages/desktop-app/src/lib/components/ui/.Test plan
bun run test(frontend baseline): 232 test files / 4895 tests passed, both before and after changes — no regressionsbun run test:all(full frontend + skill + Rust): passes on currentmainbun run quality:fix: 0 ESLint errors/warnings,tsc --noEmitclean,cargo fmt+cargo clippy -D warningscleanCloses #2454
🤖 Generated with Claude Code
https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY