test(web): park the pointer before RightPanelTabs keyboard tests #21901
main fromrefs/pull/21901/head·opened View on GitHubProblem#
The Test Web job fails now and then on PRs that don't touch this area (#21457 is one example). The failing test is RightPanelTabs.keyboard.browser.test.tsx, "uses a custom binding from a text field and closes on Escape". Focus ends on <body> instead of the "Add panel surface" trigger.
The cause is the real browser pointer. It stays wherever an earlier test file in the same browser left it. If the new-tab menu opens under it, Escape removes the popup from under the pointer and Chromium fires a mouseleave. Base UI handles that as a hover close and skips returning focus to the trigger. Whether the test passes depends on where the previous file parked the mouse.
Change#
Test only. A beforeEach hovers a 16px element fixed in the bottom-right corner, then removes it, so every test in the file starts with the pointer away from the panel and its menu. The Escape test keeps both assertions: the menu closes, and focus returns to the trigger. No production code changes.
Upstream note, not changed here: Base UI treats a mouseleave that follows a keyboard Escape as a hover close, so focus return is skipped. Whether that should change is a question for Base UI, and this PR leaves it alone.
Verification#
- Repro: a scratch copy of the test file hovers the open menu in a
beforeAll, which leaves the pointer on the popup, then runs the Escape test in a fresh browser each time. Without this change it failed 5 of 10 runs with the same assertion. With it, 10 of 10 passed. RightPanelTabs.keyboard.browser.test.tsxalone: 30 of 30 runs passed.- Full web suite,
vp test run --project unit --project browserinapps/web: 5 of 5 runs passed, 533 files and 8138 tests each. vp lint,vp fmt --checkand theapps/webtypecheck pass.
Not checked#
- CI on this branch, until it runs here.
- Five clean full-suite runs is light evidence on its own. Before this change the full suite hit this failure about once in 5 to 7 runs, so the forced repro above is the stronger proof.
- Other browser test files that leave the pointer over a popup. I only looked at this one.
- Firefox and WebKit. The suite runs Chromium.
Test fix and PR description written with Claude Opus 5.5 in T3 Code Nightly.
🤖 Generated with Claude Opus 5.5 in T3 Code Nightly
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f6deb5a2-822d-48de-9bd5-d113522566f8
📥 Commits
-
Reviewing files that changed from the base of the PR and between f740a97947cc701859040e530e7fe07b96d02ae5 and a9c1b5b48fb7a0fca8c3cf03534475e3eb3e7d01.
📒 Files selected for processing: 1
-
apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
📝 Walkthrough
-
The browser test imports
userEvent. Its asynchronous setup moves the pointer to a temporary element in the bottom-right corner, removes the element, and then continues the existing setup.Changes: Keyboard browser test
Layer / File(s) Summary Pointer setup
apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsxThe test imports userEventand moves the pointer over a temporary bottom-right element before setting up fake timers and the test DOM.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Other
Suggested reviewers:
bil0000
### Architecture SummaryMerge Risk: ⚪ Minimal · up to
a9c1b-
This test-only change parks the pointer away from the menu before the Escape test runs. No concrete merge-blocking issue is evident.
Architecture risk: 🔵 Low · up to
a9c1bThe change affects 1 system.
Changed systems:
apps/webArchitecture concerns No architecture-level concerns identified.
Review details
-
Systems and components
- observed — apps/web (ui) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsx: Adds the browser
userEventimport. - observed — Modified behavior in apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsx: Changes
beforeEachto async and moves the pointer over a temporary bottom-right element, then removes it before the existing test setup proceeds.
Pre-merge checks:
4-
Check name Status Explanation Title check The title is concise, uses the repository's conventional format, and clearly describes the pointer-parking change in the browser tests. Description check The description clearly covers the problem, change, verification results, limitations, and scope of the test-only fix. The required Scope and approval heading is omitted, although the description refe… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description clearly covers the problem, change, verification results, limitations, and scope of the test-only fix. The required Scope and approval heading is omitted, although the description references the related issue and explains why production code is unchanged.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Closing as superseded by #22523 (merged). The cause you found, a pointer left where an earlier test file put it, is now handled once for all browser tests. The shared
render()inapps/web/test/render.tsxmoves Playwright's mouse off the page when each screen is disposed, through aresetPointerbrowser command inapps/web/vite.config.ts.RightPanelTabs.keyboard.browser.test.tsxonmainalready usesrender(), so it gets this reset. This branch also conflicts with that migration.I did not reproduce this specific failure after the change. If it shows up again on
main, reopen this and we'll look again.t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Approvability#
Verdict: Approved at
a9c1b5bMacroscope's review found this PR approvable — The PR is confined to an ignored browser-test file and only stabilizes pointer state before keyboard tests. It does not change production behavior, product defaults, or static-analysis configuration.
Notes:
- No code objects were reviewed. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).