Skip to content

fix(frontend-defaults): a composer that mounts late no longer takes focus from a panel control the user moved to - #1260

Open
omridevk wants to merge 3 commits into
mainfrom
fix/shell-resize-focus-flake
Open

omridevk wants to merge 3 commits into
mainfrom
fix/shell-resize-focus-flake

Conversation

@omridevk

Copy link
Copy Markdown
Contributor

What

shell.e2e "the user resizes the panel from the keyboard" failed now and then on CI: focus was on the composer's "Add an attachment" button instead of the resize handle.

Why

packages/frontend-defaults/src/routes/panel.tsx: the effect on [open, restoringFocus, composerFocus.handle] focused the composer every time a composer input handle registered. The chat pane registers its handle when it finishes mounting, so a composer that mounted late (about 540 ms after the user tabbed, under load) took focus from the control the user had already moved to.

Fix

The effect does not move focus while focus is already inside the panel, until the panel has focused a composer once since it opened (composerFocusedSinceOpen, reset on close). Opening from the launcher or Ctrl+., Back to chat, Escape from settings, re-login and returning to the Chat tab from a plugin view still focus the composer.

Also a test fix in settings.e2e: "settings open on General, then on the last section the user left" clicked Back while the Shortcuts route was still pending (router defaultPendingMs: 300), so onEnter never wrote the last tab. The test now waits for the Shortcuts page itself before leaving. This flake exists on main too.

Runs

Resize test under 6x CPU throttle: 15/18 before, 20/20 and 24/24 after. settings.e2e unthrottled: 4/10 failed before on a loaded machine, 10/10 after. shell, pane, settings and composer e2e: 101/101.

🤖 Generated with Claude Code

omridevk and others added 3 commits November 29, 2026 01:50
…ocus from a panel control

The open-panel composer focus effect reran whenever the composer handle
registered. When the chat pane finished loading after the user had already
moved focus inside the panel (a resize handle), focus jumped to the composer
and the next Tab or arrow key went there. Focus moves to the composer only
while nothing inside the panel holds focus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…focus to leave the panel; the settings test waits for the Shortcuts page

The late-composer guard now applies only until the panel has focused a
composer once since it opened, so going back to the Chat tab from a plugin
view focuses the composer again as before.

The settings journey flaked with or without the guard: when the Shortcuts
route takes longer than the router's 300 ms pendingMs, the pending match
already marks the Shortcuts tab selected, the test pressed Back to chat
before the route committed, and its onEnter never stored the last tab. The
test now waits for the Shortcuts page itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 431fdb00-c59b-4a47-aba9-72b5886943a4
Commits

Reviewing files that changed from the base of the PR and between 4f81409 and 48aa365.

Files selected for processing: 4

  • .changeset/panel-late-composer-keeps-focus.md
  • packages/frontend-defaults/src/routes/README.md
  • packages/frontend-defaults/src/routes/panel.tsx
  • packages/frontend-defaults/test/e2e/settings.e2e.test.tsx
  • 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

This branch has not been deployed

No deployments
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