Skip to content

fix(desktop): open home on editor escape#5375

Open
ComputelessComputer wants to merge 3 commits into
fix/sidebar-timeline-settingfrom
fix/escape-opens-home
Open

fix(desktop): open home on editor escape#5375
ComputelessComputer wants to merge 3 commits into
fix/sidebar-timeline-settingfrom
fix/escape-opens-home

Conversation

@ComputelessComputer
Copy link
Copy Markdown
Collaborator

@ComputelessComputer ComputelessComputer commented May 29, 2026

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 useMainEscapeShortcutAction that reads latest tab state via useTabs.getState() (fixes stale closures). The capture-phase listener no longer bails on every defaultPrevented event—it uses shouldSkipEscapeShortcut, which still runs home for data-main-escape-target (title) and for .ProseMirror unless a data-editor-escape-consumer popup is in the DOM. TitleInput calls the same action on Escape and marks the input with data-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.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for old-char canceled.

Name Link
🔨 Latest commit 9ab78f6
🔍 Latest deploy log https://app.netlify.com/projects/old-char/deploys/6a19b21c261f3f0008673141

Comment thread apps/desktop/src/store/zustand/tabs/chat-mode.test.ts
Comment thread apps/desktop/src/sidebar/custom-sidebar-header.tsx
@ComputelessComputer ComputelessComputer changed the base branch from main to fix/sidebar-timeline-setting May 29, 2026 17:01
@ComputelessComputer ComputelessComputer force-pushed the fix/sidebar-timeline-setting branch from 6f9f4a7 to fda8cce Compare May 29, 2026 17:07
@ComputelessComputer ComputelessComputer force-pushed the fix/sidebar-timeline-setting branch from fda8cce to 5d76b00 Compare May 29, 2026 17:11
@ComputelessComputer ComputelessComputer force-pushed the fix/escape-opens-home branch 2 times, most recently from 5f85547 to d7bc2c8 Compare May 29, 2026 17:19
@ComputelessComputer ComputelessComputer force-pushed the fix/sidebar-timeline-setting branch from 33fd9e5 to bace6ce Compare May 29, 2026 17:22
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.
@ComputelessComputer ComputelessComputer force-pushed the fix/sidebar-timeline-setting branch from bace6ce to 4a81d99 Compare May 29, 2026 17:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 357719e. Configure here.

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