Keep keyboard focus visible in long source dialogs

Merged
SI
1mo ago
+12-1

When a long source is scrolled to its outbound link, Tab can wrap focus to Close while leaving it above the visible dialog. Reveal focused content with nearest scrolling and reserve padding for its focus ring inside the existing Radix dialog.

Validation: all 1,417 tests across 343 files, full TypeScript, scoped lint, formatting, whitespace and production build pass. Native keyboard checks use 160-character source labels, a withdrawn source and an outbound link at 320, 390, 768 and 1440 CSS pixels in light and dark themes. All 48 focus observations remain contained and visible; all eight Escape cycles return to the source button. The same 320px sequence reproduced an off-screen Close before the repair. Temporary synthetic fixtures were restored before commit.

Refs #2203. Real 200% zoom, screen-reader and physical-device checks remain separate.


Summary by cubic

Fixes keyboard focus visibility in long source dialogs so Tab no longer reveals the Close button while it stays out of view.

  • Reveals the focused element with nearest scrolling on focus capture.
  • Adds scroll padding so the focus ring stays fully visible at the scrollable edges.

Summary by CodeRabbit

  • Bug Fixes

    • Improved keyboard navigation in long source dialogs by keeping focused controls visible without unwanted scrolling.
    • Added scroll padding so focus indicators remain visible when moving between controls.
  • Documentation

    • Documented the improved focus behavior in long source dialogs.