Skip to content

Keep overlays open when focusing the chat composer - #37403

Merged
AmethystLiang merged 9 commits into
mainfrom
AmethystLiang/quick-launch-flashes-on-and-off
Nov 2, 2026
Merged

AmethystLiang merged 9 commits into
mainfrom
AmethystLiang/quick-launch-flashes-on-and-off

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1031 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1028
Prod 29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​631 $\color{#cf222e}{\Huge{\mathbf{−}}}$​296 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​335

Problem

Quick launch and other open menus or dialogs can flash closed when the chat composer takes focus.

Solution

Let open overlays keep focus when the composer becomes ready or tries to recover focus. Dismissed overlays and dialogs containing the chat can still allow the composer to receive focus.

ELI5

When you open a menu, chat waits instead of pulling your attention away and closing it.

What Changed

The chat composer checks for visible overlays before requesting or recovering focus. Tests cover menus, dialogs, queued focus recovery, dismissed menus, and chat hosted inside a dialog.

Why

Open overlays should keep control of focus until they are dismissed. Reusing the existing overlay check also handles overlays that are closing or contain the chat.

Linked Issue

None.

Visual Proof

TODO: Attach before and after video.

Testing

Automated tests were added for the focus behavior. Test execution and manual platform testing are not confirmed.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Risk

Level: Medium. Focus recovery could be skipped when an overlay is open, leaving the composer unfocused. A regression could affect chat users on any platform. Revert the change to restore the previous behavior.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Cross-platform, SSH, mobile, compatibility, security, and performance verification remain unconfirmed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

Overlay ownership utilities and UI components track focus scopes and dismissal. Composer focus requests use overlay ownership to coordinate focus recovery across menus, dialogs, sheets, suggestion menus, editors, and panes. The changes also add tests for delayed focus, cancellation, nested overlays, and dismissal. Quote insertion now passes selected text through a callback that closes the context menu and appends the formatted quote to the composer.

Merge Risk: Low · previous review d8102

An open attachment search can prevent automatic composer focus. Users can click the composer as a workaround; this limitation should be addressed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: preventing overlays from closing when the chat composer receives focus.
Description check Passed The description follows the required structure and explains the problem, solution, scope, testing, and risk. It is mostly complete, although the linked issue is listed as None and the required visual …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description follows the required structure and explains the problem, solution, scope, testing, and risk. It is mostly complete, although the linked issue is listed as None and the required visual proof remains TODO.

Full details: Docstring Coverage

Explanation

Docstring coverage is 16.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 37 functions across 34 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • 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.

Share

@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/quick-launch-flashes-on-and-off branch from 63b1b58 to ce9dfcf Compare November 2, 2026 09:17
Comment thread src/renderer/src/lib/visible-overlay.ts Resolved
@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/quick-launch-flashes-on-and-off branch 2 times, most recently from f2dfc53 to 6e9ef31 Compare November 2, 2026 19:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up Comments

Outside diff Mark the attachment result list as page content so it does not suppress composer focus.

19-23: Minor · Functional Correctness · Quick win

Mark the attachment result list as page content so it does not suppress composer focus.

The inline attachment result list in WorkspaceAttachmentSearch has no data-focus-behavior="page" marker. The list renders whenever query.trim() is nonempty, and the query persists after the search loses focus. getOverlayFocusOwners therefore counts the list as a visible overlay owner, including when it sits outside the chat root.

At the full PR base, composer focus requests were not gated on overlay owners. With this PR, a visible stale result list can cause a composer reveal or tab re-activation focus request to return early. The composer does not receive focus, and the user must click it. This regression is introduced by the new focus guard. The attachment component itself was not changed by the PR.

The correction is to mark this inline result list as page content, using the same data-focus-behavior="page" convention that the overlay ownership module already excludes. Apply the marker to the element that the overlay selector matches, which is the listbox that SmartWorkspaceSourceResultList renders. Confirm that selector before changing the marker location. The exact element and prop path were not inspected, so no code diff is proposed.

Open the source location


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 369c8bba-607a-4e41-af51-5c6643fd0878
Commits

Reviewing files that changed from the base of the PR and between 6e9ef31 and d8102f0.

Files selected for processing: 5
  • src/renderer/src/components/floating-terminal/floating-terminal-panel-render-probe.ts
  • src/renderer/src/components/floating-terminal/floating-terminal-panel-test-harness.ts
  • src/renderer/src/components/native-chat/NativeChatPromptEditor.overlay-focus.test.tsx
  • src/renderer/src/components/native-chat/native-chat-pane-local-overlay-focus.test.tsx
  • src/renderer/src/components/ui/dialog.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/quick-launch-flashes-on-and-off branch from 371af25 to a8ea227 Compare November 2, 2026 21:15
Scope recovery overlays to their own pane and let menus dismiss before
returning focus to the composer. This keeps the quick launcher open
when delayed chat actions complete.
Track focus ownership through portaled overlays so the launch prompt can
regain focus while its model list is open. Close the context menu before
inserting a quote so the caret lands after it.
@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/quick-launch-flashes-on-and-off branch from a8ea227 to e8d4e60 Compare November 2, 2026 21:30
@AmethystLiang
AmethystLiang merged commit b96d19d into main Nov 2, 2026
54 of 55 checks passed
audichuang pushed a commit to audichuang/orca that referenced this pull request Nov 3, 2026
* Preserve open overlays when focusing the chat composer

* Fix chat composer focus after launch menus close

* Fix chat composer focus handoff after overlays close

* Fix composer focus after custom overlays close

* Prevent chat composer from stealing overlay focus

Scope recovery overlays to their own pane and let menus dismiss before
returning focus to the composer. This keeps the quick launcher open
when delayed chat actions complete.

* Fix composer focus across nested overlays

Track focus ownership through portaled overlays so the launch prompt can
regain focus while its model list is open. Close the context menu before
inserting a quote so the caret lands after it.

* Fix overlay focus CI regressions

* Complete overlay focus ownership for inline and retained surfaces

* Declare public overlay focus hook return type

(cherry picked from commit b96d19d)
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