Skip to content

fix(desktop): close focused threads on Escape#2154

Merged
baxen merged 1 commit into
mainfrom
fizz/escape-focus-thread
Jul 20, 2026
Merged

fix(desktop): close focused threads on Escape#2154
baxen merged 1 commit into
mainfrom
fizz/escape-focus-thread

Conversation

@baxen

@baxen baxen commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Why

Escape did not reliably exit focused thread mode when focus was inside the thread composer.

What

  • Make the focused thread drawer own Escape at the capture phase
  • Exit focused thread mode on the first Escape press regardless of composer or autocomplete focus
  • Cover the focused-composer and open-autocomplete path in the focus-mode E2E test

Risk Assessment

Low — the capture listener exists only while the focused thread drawer is mounted.

References

  • pnpm --dir desktop build:e2e
  • Focus-mode Playwright spec (2 passed)
  • Pre-push desktop checks and tests passed; the unrelated Codex adapter tests remain flaky under the parallel pre-push suite and pass individually

Generated with Fizz 🐝

Co-authored-by: npub1rf6fvdj6ut0c4kcmjv4p5mmgh89nj58n69uu3fz3cvk3jn500hqs7emz79 <1a7496365ae2df8adb1b932a1a6f68b9cb3950f3d179c8a451c32d194e8f7dc1@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1rf6fvdj6ut0c4kcmjv4p5mmgh89nj58n69uu3fz3cvk3jn500hqs7emz79 <1a7496365ae2df8adb1b932a1a6f68b9cb3950f3d179c8a451c32d194e8f7dc1@sprout-oss.stage.blox.sqprod.co>
@baxen
baxen force-pushed the fizz/escape-focus-thread branch from b295ea9 to 65161ad Compare July 20, 2026 02:56
@baxen
baxen marked this pull request as ready for review July 20, 2026 03:06
@baxen
baxen requested a review from a team as a code owner July 20, 2026 03:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65161adce5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +149 to +151
event.preventDefault();
event.stopImmediatePropagation();
onClose();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Let topmost overlays handle Escape first

Because this handler is registered on window in the capture phase, calling stopImmediatePropagation() here prevents any foreground dialog/lightbox opened from a focused thread from seeing Escape. For example, markdown image previews and composer attachment dialogs in the thread already use Escape to close themselves; with this change, pressing Escape closes/unmounts the entire focus drawer instead of dismissing the topmost preview and returning to the focused thread.

Useful? React with 👍 / 👎.

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No behavioral findings on 65161adce5af8ce467fc353120ed9775ce3b0c76. The capture-phase handler intentionally gives focused-thread dismissal priority over composer/autocomplete Escape handling, and the E2E covers that regression. CI is green. Approval is withheld because this head is 12 commits behind current main; per the repository review gate, approval requires a rebased head with fresh green CI.

@baxen
baxen merged commit 9fb1a90 into main Jul 20, 2026
25 checks passed
@baxen
baxen deleted the fizz/escape-focus-thread branch July 20, 2026 15:58
wpfleger96 added a commit that referenced this pull request Jul 20, 2026
…rics

* origin/main: (96 commits)
  fix(desktop): prefer live agent mentions (#2149)
  fix(desktop): close focused threads on Escape (#2154)
  fix: skip membership lookup for open relays (#2107)
  fix(desktop): make invite QR downloadable (#2168)
  Archive managed agents when deleted (#2135)
  perf(relay): cache Git pack hydration (#2169)
  chore(deps): update rust crate rustls to v0.23.42 (#2151)
  chore(deps): update dependency @tanstack/react-virtual to v3.14.6 (#2153)
  Add Agent Config Core: harness capability model behind agent config surfaces (#2158)
  chore(deps): update all non-major dependencies (#2152)
  chore(deps): update rust crate getrandom to v0.4.3 (#2150)
  fix(relay): bound and observe Git read operations (#2167)
  fix(desktop): derive default clone URL for relay-hosted repos (#2166)
  fix(desktop): mask composer rounded corners (#2165)
  feat(desktop): add PR merge conflict recovery (#2164)
  fix(desktop): mask scrolled content behind channel and thread composers (#2163)
  feat(desktop): add inline PR diff comments (#2162)
  feat(desktop): add commit-scoped PR review decisions (#2161)
  fix(desktop): batch project work item queries (#2160)
  feat(desktop): make missing project checkouts actionable (#2159)
  ...
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