Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(web): park the pointer before RightPanelTabs keyboard tests #21901

Closedonly21mil(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/21901/headopened View on GitHub

Problem

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.tsx alone: 30 of 30 runs passed.
  • Full web suite, vp test run --project unit --project browser in apps/web: 5 of 5 runs passed, 533 files and 8138 tests each.
  • vp lint, vp fmt --check and the apps/web typecheck 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

    2. Approvability

      Verdict: Approved at a9c1b5b

      Macroscope'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).
    3. Review in Change Stack →

      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.tsx
      The test imports userEvent and 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

      Merge 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 Summary

      Architecture risk: 🔵 Low · up to a9c1b

      The change affects 1 system.

      Changed systems: apps/web

      Architecture 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 userEvent import.
      • observed — Modified behavior in apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsx: Changes beforeEach to async and moves the pointer over a temporary bottom-right element, then removes it before the existing test setup proceeds.
      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title is concise, uses the repository's conventional format, and clearly describes the pointer-parking change in the browser tests.
      Description checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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
      Comment `@coderabbitai help` to get the list of available commands.
    4. 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() in apps/web/test/render.tsx moves Playwright's mouse off the page when each screen is disposed, through a resetPointer browser command in apps/web/vite.config.ts. RightPanelTabs.keyboard.browser.test.tsx on main already uses render(), 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.

Sign in to join this conversation.