Repository navigation
Try to avoid FF browser test flake - #3398
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
david-crespo
enabled auto-merge (squash)
October 7, 2026 14:44
david-crespo
disabled auto-merge
October 7, 2026 15:02
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Oct 9, 2026
oxidecomputer/console@14ec752...00cc6bf * [00cc6bf6](oxidecomputer/console@00cc6bf6) oxidecomputer/console#3312 * [d9229150](oxidecomputer/console@d9229150) oxidecomputer/console#3399 * [cc346756](oxidecomputer/console@cc346756) oxidecomputer/console#3398 * [d7258e7c](oxidecomputer/console@d7258e7c) oxidecomputer/console#3397 * [d0c0cc4d](oxidecomputer/console@d0c0cc4d) oxidecomputer/console#3395 * [4f1ba374](oxidecomputer/console@4f1ba374) oxidecomputer/console#3394
david-crespo
added a commit
that referenced
this pull request
Nov 3, 2026
Same as #3398 but for the Subform test. 🤖 In Firefox, Playwright fill inserts text as an IME composition, and Headless UI ignores Enter for two animation frames after compositionend. The Enter that followed often landed inside that window and submitted the form. Type with real key presses instead.
This branch was successfully deployed
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.
https://github.com/oxidecomputer/console/actions/runs/37562428363/job/112602625115?pr=3348
In an action menu test, it seems like the escape key fails to close the menu when we expect. This has happened only a few times and I couldn't repro it locally. This fix is the robots' best guess, appropriately explained and caveated in a comment. Bot found 9 failures in ~317 CI runs since Aug 17.
Full 🤖 investigation and failure to repro
Goal: reproduce https://github.com/oxidecomputer/console/actions/runs/37562428363/job/112602625115?pr=3348 and determine whether Firefox fill/composition suppresses Escape.
Summary
"filters items and resets the search when dismissed" in
ActionMenu.browser.spec.tsxhas failed in 9 CI jobs since 2026-08-17. Every failure was in Firefox, and the menu was still open after Escape. The failure hasn't been reproduced in Vitest locally.The leading hypothesis is Base UI's IME composition guard. In Firefox, Playwright's
fill()inserts text through a composition, so it emitscompositionstart/compositionend. Base UI ignores Escape while composing, and only clears that state in a 0 mssetTimeoutaftercompositionend. An Escape that arrives before that timer runs is discarded. Typing the text instead of filling it produces no composition events, which is the change in this PR.That mechanism is demonstrated with the real ActionMenu in a standalone Firefox repro, but the repro's trigger (timers deferred while the page is still loading) can't occur in a Vitest run. So it's still unknown why the timer would be late in CI, and whether typing fixes the flake. Focus loss to the parent page is an alternative that produces the same symptom, but fits the failure history less well.
CI failure history
Searched every run of the CI workflow since the browser specs landed on 2026-08-17 (#3287), 317 runs. Runs with a rerun had each attempt checked, because a rerun that passes hides the first attempt's failure. Kept jobs whose "Run Vitest browser tests" step failed and grepped their failed-step logs (
gh run view --job <id> --log-failed). Two job listings returned GitHub 502s, so the count may be short by one or two."filters items and resets the search when dismissed" failed in 9 jobs across 8 runs, all Firefox. It never failed in Chromium or WebKit:
That's 6 failures in the first two days and 3 in the six weeks after #3353 (2026-08-26) changed it to an input-targeted Escape. The rate dropped but the failure didn't go away. Over the same period Firefox had single failures in four different
Combobox.browser.spec.tsxtests on 08-17/18. The other failed Vitest steps were consistent breakage on feature branches (SubscriptionsField, NumberInput) or unhandled errors.The two #3348 failures aren't explained by that branch missing something from main. #3348 is stacked on
oxql-page, which is 13 commits behind main, but none of those touch ActionMenu, the Vitest config, or the CI workflow. Base UI, Vitest, Playwright andvitest-browser-reactversions are the same in both lockfiles. #3348 doesn't add browser specs, and main itself failed on 08-17 and 08-18.Mechanism
Composition guard, reproduced outside Vitest
A standalone Firefox script serves the real ActionMenu in a small React harness (Vite, Firefox 151.0, Playwright 1.61.0, Base UI 1.1.0). It reproduces the stuck dialog without changing the component or the timer delay.
It holds an async script request open so the document stays
interactive, and keeps the browser event queue occupied with short MessageChannel tasks. It fillsdb1, checks the filtered options, focuses the input, and presses Escape. Firefox defers Base UI's composition-reset timer until the document finishes loading. Escape is discarded, and finishing the load afterward does not close the dialog. A second Escape closes it.One captured run:
The script reproduced the stuck dialog in 3/3 runs. Each of three controls closed it in 3/3 runs: type
db1instead of filling, await page load before filling, or disable Firefox'sdom.timeout.defer_during_loadpreference.Load-time timer deferral is ruled out for Vitest
Vitest 5 waits for the test iframe's
loadevent before preparing and executing tests. Injecting the same pending script into its initial HTML makes Vitest wait, and the test passes afterward.Firefox treats a window as loading only when its own document is
loading/interactiveor an ancestor is (Document::NotifyLoadingmirrors the top-level state down to subdocuments;nsGlobalWindowInner::SetActiveLoadingStatepasses it toTimeoutManager::SetLoading). Sibling iframes don't count. In a Firefox Vitest run,document,parentandtopall reportcomplete200 ms into a test. The failing test is also the second in its file, so the iframe had already run a test. The standalone repro shows the guard in action, but its trigger can't occur here.Effect re-run cancellation is a real Base UI hole, but not this test's
useDismiss's effect cleanup callscompositionTimeout.clear()and never resetsisComposingRef. If the effect re-runs betweencompositionendand the 0 ms timer, every later Escape is ignored until another composition happens. Instrumenting the deps shows one re-run per open, whenfloatingElementgoes fromnullto the popup about 4 ms after mount.vitest-browser-react'srenderwraps inact(), so that re-run finishes beforefill()starts. The reopen at the end of the test triggers it again, but no composition follows.Focus loss as an alternative
Moving focus elsewhere inside the test iframe should still let Base UI see Escape through its document listener. Losing focus to the parent page could make it miss the key entirely. Vitest's targeted
type(search, '{Escape}')focuses the input, then sends a page-level key event, leaving a gap between those operations.A focus probe produced the same symptom with the actual menu and no composition events. It loads the real ActionMenu in an iframe, waits for loading to finish, and types
db1rather than filling. Captured events show:data-open, search remainsdb1, and the test document reportshasFocus() === false.The probe introduces the focus steal on purpose. It doesn't reproduce a spontaneous focus loss in Vitest or explain what would steal focus in CI, and typing doesn't protect against it.
Focus loss fits the failure history less well than composition. Every failure is in the filter test, and the ones checked showed
value="db1"anddata-open. "dismisses with Escape" sends a global Escape to the same freshly rendered menu and has never failed in CI. The filter test has failed with a global Escape (before #3353) and with an input-targeted Escape (after), so the delivery path doesn't seem to matter. The only step the filter test adds isfill(), which is what produces composition events in Firefox.What's left
The guard path with a timer that's late for an ordinary reason. Firefox dispatches a 0 ms, non-nested timeout as an immediate normal-priority runnable to the window's event target (
TimeoutExecutor::ScheduleImmediate). So Escape can only win if its keydown overtakes an already-queued runnable. That could happen if Juggler's key dispatch reaches the content process on a higher-priority queue than the window's timer queue, or if the per-window timer queue is backed up. Not verified.A CI failure would distinguish the hypotheses if the test recorded the composition-timer fire time, the Escape keydown time and target document,
document.hasFocus(), and focus transitions, and attached them to the failure. The failure's DOM snapshot alone can't.Attempts that didn't reproduce it
The original test sequence, instrumented for composition events, timer firing/cancellation, input focus, and Escape delivery, passed:
No timer cancellation or missed Escape was captured in those runs.
A diagnostic-only 1000 ms delay of the composition-reset timer reproduced the original failed dialog-disappearance assertion. Typing passed 10 repetitions under that same delay. A 100 ms delay passed with tracing enabled, which shows how recording can mask short windows.
A headless background-tab experiment did not make Firefox report the page hidden or unfocused.
None of the release notes for Base UI 1.1–1.8, Playwright 1.61–1.63 or Vitest 5.0–5.0.3 mention a fix for this. Base UI's latest release still has the same composition-reset timer.
Sources