Skip to content

fix: keep keyboard shortcuts alive while a note is open#318

Merged
fjbarrett merged 2 commits into
mainfrom
fix/web-shortcuts-note-open
Jul 10, 2026
Merged

fix: keep keyboard shortcuts alive while a note is open#318
fjbarrett merged 2 commits into
mainfrom
fix/web-shortcuts-note-open

Conversation

@fjbarrett

Copy link
Copy Markdown
Owner

Summary

  • With a note open, every single-key shortcut was dead and reloading made it universal: the keydown gate bailed whenever a target was set (not just while typing), and the editor grabbed focus even on session restore, so keystrokes landed in the note body — only ⌘K survived. This is the "most shortcuts don't work" bug.
  • Gate on actual typing instead. With the pane open and focus out of the text: j/k step through notes in place (without stealing focus, so you can keep navigating), p/a/Del/?/n// all work; Enter/o still drops you into the text ready to type.
  • Session restore and keyboard navigation open notes with autoFocus: false; explicit opens (click, Enter/o, search) still focus the editor — that behavior was deliberate and stays.
  • New typing-safe combos matching the Mac app's Note menu: ⇧⌘P toggle pin, ⌃⌘A toggle archive. Documented in the ⌘/ sheet.
  • Fixes a latent race this exposed: the autosave draft snapshots pinned/archived, so a pin/archive from the sidebar menu (or now a shortcut) during a pending edit got reverted by the next flush. The editor now resyncs each flag from the note as it changes.

Test plan

  • npm test — 125/125
  • npm run build — clean
  • Playwright against a dev server: restore lands focus on BODY; j/k switch the open note; p pins; ? opens the sheet; mid-edit ⇧⌘P/⌃⌘A act on the open note while plain keys still type; a pin during a pending edit survives the autosave flush
    🤖 Generated with Claude Code

fjbarrett and others added 2 commits July 9, 2026 19:20
Opening a note killed every single-key shortcut two ways: the keydown
gate bailed whenever a target was set (not just while typing), and the
editor grabbed focus even on session restore, so after any reload every
keystroke went into the note body — only ⌘K survived. Gate on actual
typing instead, skip the focus grab for restores and j/k navigation
(explicit opens still focus, ready to type), and add ⇧⌘P / ⌃⌘A combos
that work mid-edit, matching the Mac app's Note menu.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The autosave draft snapshots pinned/archived, but the editor never
resynced them when the sidebar menu or a keyboard shortcut changed the
open note, so the next flush wrote the stale flags back. Sync each flag
from the note as it changes — separately, so an external archive can't
revert a not-yet-flushed local pin toggle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fjbarrett
fjbarrett merged commit 716f994 into main Jul 10, 2026
3 checks passed
@fjbarrett
fjbarrett deleted the fix/web-shortcuts-note-open branch July 10, 2026 02:29
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