Skip to content

Keep global shortcuts alive after a file picker - #73

Merged
wassgha merged 1 commit into
mainfrom
fix/space-hotkey-file-input
Aug 6, 2026
Merged

Keep global shortcuts alive after a file picker#73
wassgha merged 1 commit into
mainfrom
fix/space-hotkey-file-input

Conversation

@wassgha

@wassgha wassgha commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

The space bar play/pause hotkey stopped working. The code was never removed — the guard in the global keydown handler was swallowing it.

71d4168 added a persistent hidden <input type="file"> (components/Editor.tsx:401) that the desktop File › Open Project… menu clicks. Clicking a file input focuses it, and it stays focused after the OS picker closes. The handler bails on any focused <input>, so from then on every global shortcut — space, S, ⌘Z, Delete — is dead for the rest of the session. The transcript Import label uses the same hidden-input trick and breaks them the same way.

Fix

File inputs can't receive typed text, so they shouldn't count as a typing target.

  • lib/keyboard.ts (new) — isTypingTarget(): contentEditable / TEXTAREA / INPUT except type="file".
  • components/Editor.tsx — global shortcut handler uses it.
  • components/TranscriptPanel.tsx — the Escape and @ handlers had the same copy-pasted guard and the same latent bug; both now use it.

Testing

Typecheck and lint pass. Not yet verified end-to-end in the desktop app — repro is: open a project via the File menu, then press space.

🤖 Generated with Claude Code

The desktop File > Open Project... menu clicks a hidden <input type="file">,
which keeps focus once the OS picker closes. The global keydown handler bails
on any focused <input>, so from that point on space (play/pause), S, Cmd+Z and
Delete were dead for the rest of the session. The transcript Import label uses
the same hidden-input trick and broke them the same way.

File inputs never receive typed text, so exclude them from the guard. Pulled
the predicate into isTypingTarget() and reused it in the two TranscriptPanel
handlers (Escape, @) that had the same copy-pasted check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app.rescript Ready Ready Preview Aug 6, 2026 4:06am

@wassgha
wassgha merged commit 9ce5c01 into main Aug 6, 2026
3 checks passed
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