fix(desktop): open home on editor escape#5375
Conversation
✅ Deploy Preview for old-char canceled.
|
1a7495a to
9ab78f6
Compare
6f9f4a7 to
fda8cce
Compare
9ab78f6 to
8df134a
Compare
fda8cce to
5d76b00
Compare
5f85547 to
d7bc2c8
Compare
33fd9e5 to
bace6ce
Compare
d7bc2c8 to
2d03845
Compare
Treat bare editor Escape as a main-shell home shortcut while preserving Escape handling for visible editor popovers.
Run the main Escape shortcut from the focused title input and cover it with a regression test.
Read the latest tab store state when running the main Escape shortcut so focused title fields open home reliably.
bace6ce to
4a81d99
Compare
2d03845 to
357719e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 357719e. Configure here.
| e.stopPropagation(); | ||
| runEscapeShortcut(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Escape shortcut fires twice from title input
Medium Severity
When Escape is pressed in the title input, runEscapeShortcut executes twice. The title input's handleKeyDown calls it directly, AND the window capture listener's setTimeout also calls it because shouldSkipEscapeShortcut returns false for elements with data-main-escape-target. Both mechanisms independently trigger the same action. For chat close, this sends duplicate CLOSE events since chat.mode in the useCallback closure hasn't changed between the synchronous and asynchronous calls.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 357719e. Configure here.


Treat bare editor Escape as a main-shell home shortcut while preserving Escape handling for visible editor popovers.
Note
Low Risk
Keyboard and tab-navigation UX only; no auth, data, or payment paths. Behavior is covered by new unit tests.
Overview
Escape now consistently navigates to the home tab from the session title field and from a bare ProseMirror editor, while still letting mention and slash-command menus own Escape first.
The main-shell handler is refactored: home/chat logic lives in a shared
useMainEscapeShortcutActionthat reads latest tab state viauseTabs.getState()(fixes stale closures). The capture-phase listener no longer bails on everydefaultPreventedevent—it usesshouldSkipEscapeShortcut, which still runs home fordata-main-escape-target(title) and for.ProseMirrorunless adata-editor-escape-consumerpopup is in the DOM. TitleInput calls the same action on Escape and marks the input withdata-main-escape-target; mention/slash popups are tagged as escape consumers. Tests cover these cases.Reviewed by Cursor Bugbot for commit 357719e. Bugbot is set up for automated code reviews on this repo. Configure here.