Skip to content

fix(site): show the focus ring only after Tab and show a pointer on controls - #638

Merged
aicayzer merged 1 commit into
mainfrom
ui/focus-and-cursor
Oct 25, 2026
Merged

aicayzer merged 1 commit into
mainfrom
ui/focus-and-cursor

Conversation

@aicayzer

Copy link
Copy Markdown
Contributor

Summary

The keyboard focus ring now appears only after a reader presses Tab or Shift+Tab, never after a click, and buttons, tabs, summaries and selects show a pointer cursor.

  • Stray square gone. Click Copy on a code block, the code area or a step arrow, then press any key: the browser used to match :focus-visible and draw a grey box. The ring is now off after any press of the mouse, pen or finger, and arrow keys, space and typing do not turn it on.
  • Subtler ring. 2px, half-strength foreground, offset 2px, in light and dark. Links round the ring to 4px. Scrollable regions (the code area, Shiki's pre), tabs, summaries and the fold button draw it inside, so overflow never clips it.
  • Pointer cursor. Tailwind's reset gave every control the default cursor. One rule in app.css restores the pointer on enabled controls; disabled and aria-disabled ones keep the default.

Changes

  • src/components/pointer-focus.tsx: now records input modality as data-input="pointer" (on pointerdown) or data-input="keyboard" (on Tab, not with Ctrl, Alt or Meta) on the html element. It replaces the blur-after-click for links, which the new rule covers.
  • src/status/routes/__root.tsx: mounts PointerFocus with a relative import, so the status page, which shares app.css, gets the same behavior.
  • src/styles/app.css: new "Pointer and focus" section (cursor rule, the ring, the pointer-mode switch-off for everything but text fields, the inset list). It also turns off the shadow ring Fumadocs adds with focus-visible:ring-2, so only one ring is drawn. Per-component rules that duplicated or fought it are removed (sidebar, fold button, terminal summary, stepper, cursor: pointer and cursor: default copies).
  • src/styles/visuals.css: removes the interactive diagram button's own focus rule and cursor.
  • src/components/page-table-of-contents.tsx: drops the mobile contents button's own focus ring utilities.
  • src/AGENTS.md: new "Focus" section and a Code Review Rules bullet, so new components inherit the rule.

Testing

  • Browser, light and dark, on /guides/keep-in-sync, /guides/connector and /guides/authenticate: click Copy then ArrowDown leaves :focus-visible true with computed outline-style: none and no shadow ring; Tab then draws the ring on the code area, on Copy, on a prose link, on the theme switch and GitHub link in the header, on a tab and on the stepper arrows, none clipped. Clicking a sidebar link then ArrowDown draws no ring. The search dialog input draws no ring. A text input clicked in pointer mode keeps its ring. Cursors read pointer on buttons, tabs, summaries and the enabled stepper arrows, and default on the disabled Previous arrow.
  • pnpm build, pnpm build:status, pnpm types:check and pnpm test (700 tests) pass.
  • Not tested: Safari and Firefox, a touch device, a screen reader, the fold summary's ring by keyboard, and the mobile contents button's ring.

Notes for reviewers

  • Styling only, so no test was needed.
  • Found, not changed: the heading anchor "Copy anchor link" button is opacity-0 until the heading is hovered, so a keyboard user lands on it with no visible control or ring.
  • Contrast of the ring against the page background is about 3.4:1 in light and 5:1 in dark, both above 3:1.
  • Open pull requests 636 and 637 also edit app.css, in other sections.

Checklist

  • The title is a scoped Conventional Commit.
  • New behavior has a test that was seen failing first, or no test was needed and the reason is above.
  • Docs, comments and the contract still say what is true after this change.

@aicayzer aicayzer left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review: checks only

Styling change, looked at in the browser by the builder and again by the session; build, type check and tests pass.

@aicayzer
aicayzer marked this pull request as ready for review October 25, 2026 16:25
@aicayzer
aicayzer merged commit e6a6b0f into main Oct 25, 2026
7 checks passed
@aicayzer
aicayzer deleted the ui/focus-and-cursor branch October 25, 2026 16:26
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.

1 participant