Skip to content

fix(web): keep pull request dialog focused when opened from branch selector - #45458

Open
only21mil wants to merge 3 commits into
pingdotgg:mainfrom
only21mil:fix/web-pr-checkout-picker-keeps-dialog-focus
Open

only21mil wants to merge 3 commits into
pingdotgg:mainfrom
only21mil:fix/web-pr-checkout-picker-keeps-dialog-focus

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When choosing "Checkout pull request" from the composer branch selector, the background composer steals keyboard focus on the next animation frame instead of keeping focus in the Checkout pull request dialog. Typing then goes into the blurred composer behind the dialog.

Change

Remove onComposerFocusRequest?.() from the checkoutPullRequestItemValue branch of selectPickerItem in apps/web/src/components/BranchToolbarBranchSelector.tsx, preserving PullRequestThreadDialog's initialFocus. Regular branch picks still return focus to the composer. Added a regression test in apps/web/src/components/PullRequestThreadDialog.browser.test.tsx.

Scope

Bug fix (background composer steals focus from an open modal dialog). One-line obvious fix; no separate issue needed.

Verification

  1. Open a draft thread on Linux and open the composer branch selector.
  2. Type #123 and choose "Checkout pull request" (click or Enter).
  3. Type 456: on 0fbd3262 it lands in the composer; on fefdc493 it replaces 123 in the focused dialog input.

Setup: Ubuntu 26.04.1 LTS (Chromium 158, Browser panel), light theme, 1280x800, fresh isolated data per commit, hostname Test machine.

Steps: Draft thread in Demo Repo → branch selector → #123 → "Checkout pull request" → type 456 (click and Enter verified; picking feature returns focus to composer).

Before (0fbd3262) After (fefdc493)
Dialog stays unfocused at 123; typed 456 lands in composer
Dialog stays unfocused at 123; typed 456 lands in composer
Dialog stays focused with typed 456; composer stays empty
Dialog stays focused with typed 456; composer stays empty

Links

  • 0fbd3262, fefdc493
  • apps/web/src/components/BranchToolbarBranchSelector.tsx, apps/web/src/components/PullRequestThreadDialog.browser.test.tsx

Not shown

  • macOS/Windows desktop shells (web-only fix in BranchToolbarBranchSelector.tsx)
  • iOS/Android native mobile (separate branch picker outside apps/web)
Automated test and check results (AI agent on Linux)
  • Failing-first on base 0fbd3262: vp test run apps/web/src/components/PullRequestThreadDialog.browser.test.tsx -t "keeps dialog focus" failed at expect.element(prInput).toHaveFocus() (Expected element with focus: <input placeholder="PR URL, checkout command, or #42" ... />, Received element with focus: <textarea aria-label="Composer" />).
  • Adjacent tests on fefdc493: vp test run apps/web/src/components/BranchToolbar.logic.test.ts apps/web/src/components/PullRequestThreadDialog.test.ts apps/web/src/components/PullRequestThreadDialog.browser.test.tsx — 3 files passed, 48/48 tests passed (PullRequestThreadDialog.browser.test.tsx 3/3 passed in 1.77s).
  • vp run check:changed 0fbd32628b41e1de98f14b2ac178b50409cabc91 on fefdc493:
    • format: pass (0.5s)
    • lint: pass (1.0s, 0 warnings, 0 errors)
    • knip 1/2: pass (7.9s)
    • typecheck (2 packages): pass (0.3s)
    • knip 2/2: pass (13.6s)
    • test (1 files): pass (8.1s, 3/3)
    • react compiler (1 files): pass (4.8s, 1/1)
  • Clean merge check against newest green upstream/main (d7a8b574): git merge-tree --write-tree exited 0 (19171ddd7e04cb5844173fd6a9a60c0c99a924b0).

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 29, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at fefdc49

Macroscope's review found this PR approvable — The branch picker no longer requests composer focus while opening the pull-request dialog. This is a narrowly scoped UI-focus correction with no change to checkout behavior or product defaults.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The branch selector no longer requests composer focus when a pull-request checkout item is selected. A browser test opens the pull-request dialog through the selector and checks that its input retains focus while typing and preserves the entered value.

Changes: Checkout focus handling

Layer / File(s) Summary
Checkout focus behavior and integration test
apps/web/src/components/BranchToolbarBranchSelector.tsx, apps/web/src/components/PullRequestThreadDialog.browser.test.tsx
Pull-request checkout selection still closes the menu and invokes the checkout request, but no longer requests composer focus. The browser test checks that the dialog input retains focus while typing and that the entered value is 456.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to a9ae5

This is a small focus fix. After choosing "Checkout pull request," the dialog input keeps focus instead of the background composer taking it. Regular branch selection still returns focus to the composer. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the pull request dialog opened from the branch selector keeps focus instead of the background composer taking it. It follows the conventional commit format and uses pl…
Description check Passed The description covers the template sections. Problem explains the focus steal and expected behavior. Change names the removed call, the file, and the added regression test. Scope gives a bug-fix rati…
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: Title check

Explanation

The title names the main change: the pull request dialog opened from the branch selector keeps focus instead of the background composer taking it. It follows the conventional commit format and uses plain language. It matches the raw summary, which shows the composer focus request removed from the checkout pull request path in BranchToolbarBranchSelector.tsx.

Full details: Description check

Explanation

The description covers the template sections. Problem explains the focus steal and expected behavior. Change names the removed call, the file, and the added regression test. Scope gives a bug-fix rationale and says no issue is needed for this one-line fix. Verification lists a failing-first run, adjacent test results, a manual reproduction with before/after screenshots, and states what was not checked (macOS/Windows shells, mobile). The commit-link and agent-model footer lines also appear. The description is mostly complete and meets the pass bar.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fefdc49 and a9ae53f.

Files selected for processing: 1

  • apps/web/src/components/PullRequestThreadDialog.browser.test.tsx

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 29, 2026

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

size:XS 0-9 changed lines (additions + deletions). takeover:in-progress A takeover lead is working on this PR vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants