Repository navigation
Host browser tests: choosing a mode in the menu waits for its focus to return - #99
Merged
Merged
Conversation
…o return modes.spec's "embedders can control the comparison mode and divider" failed on the mobile projects (webkit-mobile 3 times, once on main, and chromium-mobile): ArrowRight on the swipe divider left it at 50%. There the mode switch is a menu. Choosing Swipe closes it, and the popover gives focus back to its button only as it leaves, after its exit animation. The test had focused the divider by then, and the menu took the focus back before the key. chooseMode now returns once the menu is gone and its button has focus. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the focus-restoration waits added to menu-based mode selection.
No open issues 🎉
What changed in this PR
Updates the shared host browser-test helper to prevent a closing comparison-mode menu from stealing focus before subsequent keyboard interactions, addressing the intermittent mobile divider test failure.
Changes:
- Detects whether the mode was selected through the menu.
- Waits for popover exit animations to finish and focus to return to the menu button, leaving inline desktop selection unchanged.
| File | Description |
|---|---|
packages/host/core/browser/harness.ts |
Adds and documents focus-restoration waits in chooseMode for menu-based selections. |
Review effort: Balanced
…wherever focus goes Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek
added a commit
that referenced
this pull request
Nov 20, 2026
…istry's newest (#108) * Scaffold checks: install the workspace's locked versions, not the registry's newest check-pack.mjs (the package job) and the CLI's starter browser specs (browser rest) npm-install a freshly scaffolded renderer, whose package.json asks for ranges such as @playwright/test ^1.55.0. Resolved against the live registry, that took 1.65.1, released Nov 13, whose playwright-core the registry mirror didn't list yet: ETARGET No matching version found for playwright-core@1.65.1, on #91, #92, #99, #101 and #103 on Nov 20. Every new release could do the same. Both now pin the scaffold's registry dependencies to the versions this workspace's lockfile installed (failing if a range and the installed version disagree on the major version), so they build with what CI already tested. npm also retries a request that fails on the network or with a 5xx five times rather than twice; it never retries a missing version. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * check-pack: pin the scaffold in a module of its own, within check-pack's complexity Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The flake
modes.spec.ts:188"embedders can control the comparison mode and divider":Tour dividerstays at "50%" after ArrowRight, expected "51%" (webkit-mobile ×3, chromium-mobile ×1, on #93)Cause
The failures only happen on the mobile projects. At mobile widths the comparison-mode switch is folded into a menu (a Radix popover). Choosing Swipe there closes the menu, but the popover gives focus back to its button only as it unmounts, after its exit animation. Meanwhile the test had already focused the swipe divider (
.focus()), and the closing menu took focus back beforeArrowRight, so the key went to the menu button.Fix
chooseModeinpackages/host/core/browser/harness.tsnow handles a mode chosen in the menu. It waits until no popover is playing its exit animation (settled, i.e. the menu has unmounted). Then it flushes one 0 ms timer in the page: Radix's focus scope hands focus on in a 0 ms timer started at unmount, and timers run in order. Every caller that focuses or types next keeps the focus it sets. Waiting for the button itself to take focus didn't work: on the mobile projects focus doesn't return there (an earlier push of this PR failed that way). The inline (desktop) form is unchanged.