Focus rings only for Tab navigation, never for modifiers or shortcuts #415

Closed
opened 2026-10-15 07:35:20 +00:00 by kayg · 2 comments
Owner

kayg, 2026-10-15 (screenshot attached): "can we please only show these selection rings when the user does tab tab tab to navigate between ui elements and not when they press cmd/opt or any modifiers?"

The screenshot shows an accent focus ring around the whole note page (the editor frame) while kayg is typing [[ with the link picker open and the Style sheet up. Pressing ⌘ or ⌥, or using a shortcut, flips the app into "keyboard" mode. That's data-last-input=keyboard from #344/#376 (packages/ui/src/lib/inputSource.svelte.ts), and the focus rings show up as a result.

Fix:

  • Only navigation keys switch to keyboard mode: Tab / Shift+Tab, plus arrow keys and Home/End when focus is on a roving UI control (toolbar, list, segmented control). Modifier-only presses (Meta, Alt, Control, Shift), shortcuts (⌘K, ⌘\ and so on), Escape and Enter, and anything typed in the editor never turn the rings on.
  • The editor page or article itself never shows a ring while you type in it. Check why the whole page got a ring: is it focus-visible on the scroller or article from the skip link or roving changes?
  • The #344 rule (keyboard actions don't animate) keeps its own trigger: shortcuts still skip animation. Separate the "no motion" signal from the "show rings" signal if they currently share one.
  • Tests: rings appear after Tab; no ring after ⌘, ⌥, ⌘K, Escape, or typing; no ring on the page while typing [[. Run on chromium-1440 and webkit-1440, plus keys-tab, keys-no-motion and shortcuts.
kayg, 2026-10-15 (screenshot attached): "can we please only show these selection rings when the user does tab tab tab to navigate between ui elements and not when they press cmd/opt or any modifiers?" The screenshot shows an accent focus ring around the whole note page (the editor frame) while kayg is typing `[[` with the link picker open and the Style sheet up. Pressing ⌘ or ⌥, or using a shortcut, flips the app into "keyboard" mode. That's `data-last-input=keyboard` from #344/#376 (`packages/ui/src/lib/inputSource.svelte.ts`), and the focus rings show up as a result. Fix: - Only navigation keys switch to keyboard mode: Tab / Shift+Tab, plus arrow keys and Home/End *when focus is on a roving UI control* (toolbar, list, segmented control). Modifier-only presses (Meta, Alt, Control, Shift), shortcuts (⌘K, ⌘\ and so on), Escape and Enter, and anything typed in the editor never turn the rings on. - The editor page or article itself never shows a ring while you type in it. Check why the whole page got a ring: is it focus-visible on the scroller or article from the skip link or roving changes? - The #344 rule (keyboard actions don't animate) keeps its own trigger: shortcuts still skip animation. Separate the "no motion" signal from the "show rings" signal if they currently share one. - Tests: rings appear after Tab; no ring after ⌘, ⌥, ⌘K, Escape, or typing; no ring on the page while typing `[[`. Run on chromium-1440 and webkit-1440, plus keys-tab, keys-no-motion and shortcuts.
Author
Owner

Fix is up in the PR (issue/415-tab-rings -> dev).

Cause: the ring switch data-input was written by apps/web for Tab and every arrow key anywhere. So an arrow in the [[ picker turned rings on, and the editor's contenteditable always matches :focus-visible, so it drew the accent ring around the whole note page. The ring switch and the no-motion signal were already separate attributes (data-input vs data-last-input), but the ring one was loose in apps/web.

Fix: both signals now live in packages/ui/src/lib/inputSource.svelte.ts. Rings turn on only for Tab / Shift+Tab, or arrows / Home / End on a roving control (roving lists, tablist, radiogroup, menu, listbox, splitter), never inside a field or the editor, never with a modifier held. Modifier-only keys, shortcuts, Esc, Enter and typing never do. A pointer press turns them off. The note text/page never draws a ring (base.css). data-last-input is unchanged, so shortcuts still skip animation. Both attributes are written only when the value changes.

Tests: new keys-rings.spec.ts (Tab on, click off, Meta/Alt/Control/Shift, Ctrl+K, Esc, Enter, typing, arrows in text never; arrows on a roving list on; shortcut keeps no-motion without rings; [[ with Style sheet open shows no ring). keys-tab, keys-no-motion, shortcuts, tabs, glass, editor, bar-*: chromium-1440 50 passed, webkit-1440 47 passed, chromium-390 42 passed.

Screenshots at 1440 (typing [[ with the Style sheet open, then an arrow key): before = origin/dev code, after = this fix.

Fix is up in the PR (issue/415-tab-rings -> dev). Cause: the ring switch `data-input` was written by apps/web for Tab and every arrow key anywhere. So an arrow in the `[[` picker turned rings on, and the editor's contenteditable always matches `:focus-visible`, so it drew the accent ring around the whole note page. The ring switch and the no-motion signal were already separate attributes (`data-input` vs `data-last-input`), but the ring one was loose in apps/web. Fix: both signals now live in `packages/ui/src/lib/inputSource.svelte.ts`. Rings turn on only for Tab / Shift+Tab, or arrows / Home / End on a roving control (roving lists, tablist, radiogroup, menu, listbox, splitter), never inside a field or the editor, never with a modifier held. Modifier-only keys, shortcuts, Esc, Enter and typing never do. A pointer press turns them off. The note text/page never draws a ring (base.css). `data-last-input` is unchanged, so shortcuts still skip animation. Both attributes are written only when the value changes. Tests: new `keys-rings.spec.ts` (Tab on, click off, Meta/Alt/Control/Shift, Ctrl+K, Esc, Enter, typing, arrows in text never; arrows on a roving list on; shortcut keeps no-motion without rings; `[[` with Style sheet open shows no ring). keys-tab, keys-no-motion, shortcuts, tabs, glass, editor, bar-*: chromium-1440 50 passed, webkit-1440 47 passed, chromium-390 42 passed. Screenshots at 1440 (typing `[[` with the Style sheet open, then an arrow key): before = origin/dev code, after = this fix.
Author
Owner

Closing during the 26 Oct handover cleanup: Focus rings only for Tab landed in dev (PR #431).

Closing during the 26 Oct handover cleanup: Focus rings only for Tab landed in dev (PR #431).
kayg closed this issue 2026-10-26 08:46:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#415
No description provided.