Skip to content

Give the keyboard back after using the seek bar - #49

Merged
wirelessdreamer merged 1 commit into
mainfrom
claude/hotkey-focus
Sep 6, 2026
Merged

wirelessdreamer merged 1 commit into
mainfrom
claude/hotkey-focus

Conversation

@wirelessdreamer

Copy link
Copy Markdown
Owner

Clicking the seek bar disabled Space and the arrow keys for the rest of the session.

transportHotkeys stands down whenever the key event's target is an <input> — which a range slider is — and a range natively consumes arrow keys to drive its own thumb. So focus landing on the seek bar took the transport keys with it. The control added for moving around a song was the one thing that stopped you moving around a song from the keyboard.

The fix

The guard isn't wrong: a slider you deliberately tabbed to should own its arrow keys. So the fix is at the other end — the seek bar releases focus when the pointer lifts. Click it and the hotkeys come straight back; tab to it and arrow-key adjustment still works, which is the case the guard exists for.

Not swept up

The same trap sits in every other slider on the play surface — song volume, metronome, piano gain, spacing. They're far less exposed because nobody clicks them mid-song, and they're left alone here rather than bundled into an unrelated fix.

Test

Pinned in transportHotkeys.test.ts, beside the guard itself, so the next person to add a slider to the play surface meets this in a test rather than in the app. The test asserts both halves: a focused range swallows the keys, and once focus moves away they work again.

Full suite: 1215 passed, 3 skipped.

🤖 Generated with Claude Code

Clicking the seek bar disabled Space and the arrow keys for the rest of the
session. transportHotkeys stands down whenever the event target is an <input>,
which a range slider is, and a range natively eats arrow keys to drive its own
thumb -- so focus landing there took the transport keys with it. The control
added for moving around a song was the one thing that stopped you moving
around a song with the keyboard.

The guard is not wrong: a slider that the user has deliberately tabbed to
should own its arrow keys. So the fix is at the other end -- the seek bar
releases focus when the pointer lifts. Click it and the hotkeys come straight
back; tab to it and arrow-key adjustment still works, which is the case the
guard exists for.

The same trap is waiting in every other slider on the play surface (song
volume, metronome, piano gain, spacing). They are less exposed because nobody
clicks them mid-song, and they are left alone here rather than swept up.

Pinned in transportHotkeys.test.ts, where the guard lives, so the next person
to add a slider meets this in a test rather than in the app.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wirelessdreamer
wirelessdreamer merged commit 5d275e2 into main Sep 6, 2026
1 check failed
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