Skip to content

Fix doubled focus rings in dialogs and dropdowns - #2476

Merged
malibio merged 2 commits into
mainfrom
issue-2454-doubled-focus-rings
Sep 8, 2026
Merged

malibio merged 2 commits into
mainfrom
issue-2454-doubled-focus-rings

Conversation

@malibio

@malibio malibio commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • 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 — the "doubled ring" bug. Replaced with outline-none, the v3 equivalent, in all five affected files (grep confirms no other outline-hidden remains under packages/desktop-app/src/lib/components/ui/).
  • Removed ring-offset-2 (and the now-unused ring-offset-background) from the dialog close button. On a borderless size-4 icon button, the 2px offset gap made the ring read as a floating box rather than a focus halo around the icon. Left tabs-trigger and switch untouched — both already use outline-none correctly, and their offset reads fine because they wrap filled/bordered controls.
  • Resolved the --ring contradiction in DESIGN.md (companion commit already pushed to nodespace-docs main, since that repo commits docs changes straight to main): the doc's prose (Colors section, Do's list) said focus rings are primary (teal), but the --ring token 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 --ring in app.css to match --primary, and updated DESIGN.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 :focus not :focus-visible):

  • Dialog close button (Rename Database dialog): confirmed via computed styles that outline-color is fully transparent and exactly one ring renders (box-shadow: ... rgb(29, 149, 137) 0px 0px 0px 2px in light mode, rgb(52, 157, 145) in dark mode — both match the new teal --ring token). Screenshots confirm a single clean ring in both light and dark mode, no nested-box artifact.
  • Dropdown menu item: confirmed via computed styles that outline-color is transparent and there's no stray box-shadow ring 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.svelte and dropdown-menu-sub-trigger.svelte used data-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 bare data-highlighted: occurrences (including the ones chained after data-[variant=destructive]:) to data-[highlighted]: in both files. Confirmed via grep that no bare data-highlighted: remains anywhere under packages/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 regressions
  • bun run test:all (full frontend + skill + Rust): passes on current main
  • bun run quality:fix: 0 ESLint errors/warnings, tsc --noEmit clean, cargo fmt + cargo clippy -D warnings clean
  • Manual keyboard-Tab verification in a running browser session, light and dark mode, dialog + dropdown

Closes #2454

🤖 Generated with Claude Code

https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY

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
@malibio
malibio force-pushed the issue-2454-doubled-focus-rings branch from 7cdaf8e to 63f3518 Compare September 8, 2026 10:55
@malibio

malibio commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review Summary

This is a net-positive, well-scoped fix. It correctly diagnoses and resolves a real Tailwind v3/v4 class-mismatch bug (outline-hidden silently compiling to nothing), verifies the fix with actual keyboard-navigation testing rather than assumption, and resolves a genuine, pre-existing documentation/token contradiction with a defensible WCAG justification. The --ring repaint is correctly scoped (the token is used only for focus rings across the codebase) and the ring-offset removal is deliberately limited to the one component where it visually made sense to remove it. The PR's own description is unusually candid: it discloses an adjacent, unfixed bug (data-highlighted:bg-accent, also a v3/v4 mismatch) that it deliberately did not fix, rather than silently ignoring or hiding it.

Correction to this review's original brief: issue #2469 is not about data-highlighted:bg-accent — it's an unrelated Rust struct-field-rename compile error (CreateNodeInput/UpdateNodeInput collection field renames from #2450). Issue #2462 does not resolve to that topic either. There is in fact no tracked follow-up issue for the data-highlighted:bg-accent finding the PR author discovered and disclosed in the PR description — only a comment ("happy to file a follow-up if wanted"). Flagged below as a process gap, not a fabricated duplicate-closure decision.

Requirements Check

Against #2454's acceptance criteria:

  • No outline-hidden remains under packages/desktop-app/src/lib/components/ui/ — confirmed via grep, zero hits.
  • Dialog close button shows exactly one focus indicator — outline-none + single ring-2, verified by the author via computed box-shadow/outline-color in a live browser session.
  • Indicator remains visible in both light and dark mode — confirmed both computationally (see WCAG section) and via the author's Playwright screenshots.
  • Dropdown menu items show one indicator on keyboard focus — same outline-hidden → outline-none fix applied to all 4 dropdown files.
  • --ring and DESIGN.md agree — confirmed independently: nodespace-docs commit 31d13d8 ("Align --ring token doc with teal...") updates the ring/dark-ring token doc to hsl(174 67% 35%) / hsl(173 50% 41%), matching app.css exactly.
  • Verified with keyboard navigation, not mouse — author states Playwright Tab-based verification; plausible and consistent with the specific computed-style values quoted in the PR body.

All six acceptance criteria are met. The issue's proposed fix also explicitly suggested reviewing whether ring-offset-2 should be removed for small icon buttons — done, and scoped correctly (see below).

Findings

Critical Issues

None.

Suggested Improvements

  • Follow-up issue never filed for the disclosed data-highlighted:bg-accent bug. The PR body identifies a real, separate Tailwind v3/v4 incompatibility in two of the same five files it touches (dropdown-menu-item.svelte, dropdown-menu-sub-trigger.svelte both use the v4-only bare boolean variant data-highlighted:bg-accent, which needs data-[highlighted]:bg-accent in v3) and says "happy to file a follow-up if wanted" — but no such issue exists in the tracker as of this review. Per this repo's own fix-now-vs-file-it convention, that decision should be made explicitly (with a complexity estimate) rather than left as a dangling comment. Since it's a distinct visual symptom (missing highlight background vs. doubled ring) rather than the same code path, scoping it out of this PR is reasonable — but the follow-up issue should actually be filed before this thread is forgotten.
  • PR description slightly overstates the dark-mode motivation. Independently computed contrast confirms the light-mode grey ring failed WCAG 1.4.11 (2.584:1, needs 3:1) — but the old dark-mode grey ring already passed (3.781:1, computed against --background: hsl(0 0% 9%)). Framing the change as fixing contrast "in both modes" could mislead a future reader into thinking dark mode was also broken; it wasn't. The dark-mode ring recolor is a consistency/branding change (matching the documented teal intent), not an accessibility fix. Worth a one-line correction to the PR description, not blocking.

Nitpicks

  • Nit: DESIGN.md line ~218 still lists dark-mode primary as hsl(173 73% 41%), while the token table (updated by this PR's companion commit) and app.css both use hsl(173 50% 41%) for dark ring/primary. Pre-existing prose/table inconsistency, not introduced by this PR, but since the companion commit touched that exact file for that exact token family, it would have been a low-cost drive-by fix.
  • Nit: the dark-mode contrast ratio computed independently here (5.445:1 against --background: hsl(0 0% 9%)) doesn't match the PR's claimed 6.99:1. Both clear 3:1, so it isn't consequential, but if precise numbers are ever cited elsewhere (e.g. in an ADR), they should be re-derived against the actual token values.

WCAG Contrast Verification

Methodology: standard WCAG relative-luminance formula (sRGB → linearize → relative luminance → contrast ratio = (L1+0.05)/(L2+0.05)), computed from the actual HSL values in packages/desktop-app/src/app.css, comparing the ring color against --background — the surface the dialog close button sits directly on with no intervening border/card layer, which is the correct comparison surface for a non-text UI-component boundary under 1.4.11 for this specific borderless icon button.

Old grey New teal Threshold
Light mode (--ring vs white --background) RGB(161,161,161) → 2.584:1 — FAILS RGB(29,149,137) → 3.676:1 — PASSES 3:1
Dark mode (--ring vs --background: hsl(0 0% 9%)) RGB(115,115,115) → 3.781:1 — PASSES RGB(52,157,145) → 5.445:1 — PASSES 3:1

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.
Disputed/imprecise: the dark-mode improvement is not fixing a contrast failure (old grey already passed at 3.78:1); it's a stylistic/consistency change. The PR's dark-mode ratio (6.99:1 claimed vs. 5.445:1 computed here) doesn't reproduce exactly, though the pass/fail conclusion is unaffected.

Recommendation

APPROVE — 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 data-highlighted:bg-accent bug rather than leaving it as an unlinked comment. Neither is a blocker; both are quick fixes that improve the audit trail on an otherwise clean, well-verified, atomic change.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@malibio
malibio merged commit 855c490 into main Sep 8, 2026
@malibio
malibio deleted the issue-2454-doubled-focus-rings branch September 8, 2026 12:31
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.

Dialog and dropdown focus rings render doubled: outline-hidden is a Tailwind v4 class on a v3 project

1 participant