Skip to content

Keep mail shortcuts from acting on mail hidden behind Preferences - #2951

Closed
brhellman wants to merge 2 commits into
Foundry376:masterfrom
brhellman:preferences-hold-mail-commands
Closed

brhellman wants to merge 2 commits into
Foundry376:masterfrom
brhellman:preferences-hold-mail-commands

Conversation

@brhellman

@brhellman brhellman commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Typing on a Preferences page can act on mail you can't see. The thread list and its toolbar stay mounted behind the Preferences sheet, and their commands are global. PreferencesRoot stopped a hand-picked list of them, with a TODO calling that "a partial/temporary solution", and only while focus was inside Preferences. Measured on master with the Gmail template and a focused thread (copy of a live config, Electron 44.5.1, DevTools Input.dispatchKeyEvent, queueTask stubbed):

key focus inside Preferences focus on the body
s star ChangeStarredTask queued ChangeStarredTask queued
e archive stopped ChangeLabelsTask queued, and Preferences closed

Focus lands on the body as soon as the Shortcuts page finishes recording a key, because the row blurs itself. So a user setting up shortcuts who keeps typing archives and stars mail behind the page.

  • Every mail command, not a sample. MAIL_COMMANDS covers each command the Shortcuts page lists under Actions and Selection, plus the item navigation and paging commands the old list had. core:pop-sheet stays live, so Escape and Gmail's u still leave Preferences.
  • Wherever focus is. While Preferences is mounted, a capture listener on window stops these commands when they're fired from outside it (the body). Inside, the existing KeyCommandsRegion stops them on the way out, after any list in Preferences (EditableList's core:next-item) has handled them for itself. Unmounting removes the listeners.

Verified: preferences-root-spec mounts PreferencesRoot with a mail-list handler on document.body for every command. None reaches it when fired from the body or from inside Preferences, a list inside still gets core:next-item, core:pop-sheet still passes, and after unmount core:star-item reaches the mail list again. Six mutants are red: no window listener, no local stop, stopping inside too, never stopping outside, listeners kept after close, and star dropped from the list. Live, in this branch's build with the same setup as above: s, e, l and j from inside Preferences and from the body queued nothing, and Preferences stayed open; u still left it. Lint, prettier and tsc clean; full suite 2444 passing on this branch (master 4ebb582fb).

Shortcuts page series (one concern each; merge in this order): #2950 [] unbinds, #2951 mail held behind Preferences, #2952 record with +, #2953 remove keys, #2955 conflict warnings, #2956 visual pass, #2957 search, #2958 single-key switch, #2959 Show filter.

🤖 Generated with Claude Code

Preferences stopped a partial list of mail commands, and only while focus was inside it. A
Gmail-template "s" still starred the selected thread, and once the Shortcuts page blurred a
row, focus sat on the body and "e" archived. Every mail command is now held while Preferences
is mounted, wherever focus is; lists inside Preferences still get their own navigation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manilabui

Copy link
Copy Markdown
Contributor

Since #2970 made Preferences its own section, the mail list isn't mounted while Preferences is open anymore, so I'm going to close this one. Thanks for catching it though!

@manilabui manilabui closed this Oct 15, 2026
@brhellman
brhellman deleted the preferences-hold-mail-commands branch October 16, 2026 11:35
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.

2 participants