Repository navigation
feat(web): Escape returns focus to the composer when nothing else wants it - #169
Conversation
yordis
commented
Oct 27, 2026
- After clicking into the timeline or dismissing a popup, focus is left on nothing and getting back to the composer takes a mouse trip.
- Escape is the natural "get me back to typing" key, and it already does nothing in that state, so claiming it there costs no existing behavior.
…ts it Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryMedium Risk Overview
Several features now claim Escape only when they actually handle it: sidebar pointer drags call Browser tests cover composer focus, focused fields, selection, MCP fullscreen, and already-claimed Escape. Reviewed by Cursor Bugbot for commit 3521a7d. Bugbot is set up for automated code reviews on this repo. Configure here. |
…es the composer Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Escape focus eligibility apps/web/src/components/chat/composerFocusRedirect.ts |
Added shouldEscapeFocusComposer to check key, composition, modifiers, input redirection, and selection state. |
Escape routing and browser tests apps/web/src/components/chat/useChatShortcuts.ts, apps/web/src/components/chat/useChatShortcuts.browser.test.tsx |
The Escape handler closes active thread find. Otherwise, it focuses the composer at its end when shortcuts are enabled and the event qualifies. Browser tests cover focus outcomes and prevented events. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Window
participant useChatShortcuts
participant shouldEscapeFocusComposer
participant Composer
Window->>useChatShortcuts: Dispatch Escape keydown
useChatShortcuts->>shouldEscapeFocusComposer: Check event eligibility
shouldEscapeFocusComposer-->>useChatShortcuts: Return eligibility
useChatShortcuts->>Composer: Focus at end when eligible
Suggested labels: size:M
Suggested reviewers: juliusmarminge
Merge Risk: 
Low · previous review 9387f
-
Dismissing a citation can also focus the composer. The impact is limited and does not block merging.
Pre-merge checks: 
3 · 
1
-
Failed checks: 1 warning Passed checks: 3 passed-
Full details: Title check
-
Explanation
The title "feat(web): Escape returns focus to the composer when nothing else wants it" matches the main change. The raw summary shows a new shouldEscapeFocusComposer handler in useChatShortcuts that focuses the composer on Escape when thread find is inactive and the event qualifies. The title follows the conventional commit format and is specific to the Escape key behavior. It omits the guard conditions, but it does not need to list every detail. The title is 74 characters, which is acceptable.
-
Full details: Description check
-
Explanation
The description gives two short bullets. The first describes the problem: focus is left on nothing after clicking into the timeline or dismissing a popup, so returning to the composer requires a mouse. The second gives a rationale: Escape already does nothing in that state. The template requires a Problem section, a Change section, a Scope and approval section, and a Verification section. The description has no headings and no Change explanation. It has no link to a triaged issue or maintainer approval. It has no verification steps, no tests described, and no statement of what was not checked. It also does not state the expected behavior or reproduction steps in a structured way. The description is therefore largely incomplete against the template.
Resolution
Rewrite the description to follow the repository template. Add these sections:
- Problem: State the problem in one or two sentences. Include the expected behavior and reproduction steps. For example: after clicking the timeline or dismissing a popup, no element has focus, and the user must use the mouse to return to the composer.
- Change: Explain how the Escape handler in useChatShortcuts now calls shouldEscapeFocusComposer. Explain that Escape focuses the composer only when thread find is inactive, shortcuts are enabled, and the event is unmodified, not composing, and has no non-collapsed selection.
- Scope and approval: Link the triaged issue or the discussion that gives maintainer approval for this behavior. If this change qualifies as a small, focused fix of an obvious bug, explain why no prior issue is needed. Note that a new keyboard shortcut behavior may need approval under CONTRIBUTING.md.
- Verification: List the browser tests that were run, such as the four Escape-key tests in useChatShortcuts.browser.test.tsx, and the observed results. Describe any manual checks. State anything that was not checked. Because this is a UI interaction change, add a short recording or before and after evidence if the change is visible.
- If an agent produced the change, name the model and harness at the end of the description.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
…mselves Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…overs Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3caf03. Configure here.
…pported Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
