test: #1000 wait until the Style opener really has focus before Enter #1001

Closed
kayg wants to merge 0 commits from test/1000-style-opener-focus into dev
Owner

Fixes the flake in #1000 (a11y-high.spec.ts "Style: labelled, focus in and kept, Esc returns it to the opener", webkit-390, ~10-15 %).

Cause (test timing, not an app bug). keyboardDown blurs the text; the app hears the focus change a moment later and only then swaps the bar back from the text bar to the rest tools. In that gap the Style button sits in the layer that is leaving, and that layer is inert, so opener.focus() is a silent no-op: nothing takes focus, the Enter goes to the page, and the sheet never opens. Evidence (11-07, webkit-390, dev 792b33536, in-page logging): in every failing run focusout of the editor was followed by keydown Enter with activeElement = BODY and no focusin on the button; the bar layers at that keydown were tools, text(inert). Prod 71827028 fails the same way (19/20 vs dev 17/20, see #1000).

Fix. The test retries the focus until it has landed (expect(...).toPass() around focus() + toBeFocused()), then presses Enter. No sleep. The app is unchanged: the bar-to-sheet morph, first-paint bytes and frame behaviour are untouched.

Gates are posted as a comment.

🤖 Generated with Claude Code

Fixes the flake in #1000 (`a11y-high.spec.ts` "Style: labelled, focus in and kept, Esc returns it to the opener", webkit-390, ~10-15 %). **Cause (test timing, not an app bug).** `keyboardDown` blurs the text; the app hears the focus change a moment later and only then swaps the bar back from the text bar to the rest tools. In that gap the Style button sits in the layer that is leaving, and that layer is inert, so `opener.focus()` is a silent no-op: nothing takes focus, the Enter goes to the page, and the sheet never opens. Evidence (11-07, webkit-390, dev `792b33536`, in-page logging): in every failing run `focusout` of the editor was followed by `keydown Enter` with `activeElement = BODY` and no `focusin` on the button; the bar layers at that keydown were `tools, text(inert)`. Prod `71827028` fails the same way (19/20 vs dev 17/20, see #1000). **Fix.** The test retries the focus until it has landed (`expect(...).toPass()` around `focus()` + `toBeFocused()`), then presses Enter. No sleep. The app is unchanged: the bar-to-sheet morph, first-paint bytes and frame behaviour are untouched. Gates are posted as a comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test: #1000 wait until the Style opener really has focus before Enter
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
568f9e95e0
keyboardDown blurs the text, but the app swaps the bar back to its rest tools a
moment later. Until then the Style button is in the leaving (inert) layer, so
focus() is a silent no-op and the Enter goes to the page. Retry the focus until
it lands (toPass), never a fixed sleep.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Owner

Gates for head 568f9e95e045a79a074648562fecce34043fa34d (test-only change in apps/web/e2e/a11y-high.spec.ts; the app is untouched, so bytes, perf and frames are unchanged by construction).

gate command (from apps/web, --workers=1 --retries=0) result
webkit-390, round 1 bunx playwright test e2e/a11y-high.spec.ts -g 'Style: labelled' --project=webkit-390 --repeat-each=20 (dev-02) 20/20
webkit-390, round 2 same 20/20
chromium-390, round 1 same with --project=chromium-390 (dev-01) 20/20
chromium-390, round 2 same 20/20
whole a11y-high spec, webkit-390 + webkit-1440 bunx playwright test e2e/a11y-high.spec.ts --project=webkit-390 --project=webkit-1440 (dev-02) 12 passed, 4 skipped, 0 failed
whole a11y-high spec, chromium-390 + chromium-1440 same with chromium projects (dev-01) 12 passed, 4 skipped, 0 failed
bun run check (apps/web) svelte-check 0 errors, 16 warnings (same as dev)
bun run lint (apps/web) node tests + filter-motion pass

Notes: the dev-02 runs used a dev binary built at 1e903a13a; the dev-01 runs used the del984-dev binary (db15794ac, 11-06), because dev-01 had 55 GB free and I didn't build. The spec only seeds notes and uses the editor. The root repo has no check/lint script at the top level, so they ran in apps/web.

**Gates for head `568f9e95e045a79a074648562fecce34043fa34d`** (test-only change in `apps/web/e2e/a11y-high.spec.ts`; the app is untouched, so bytes, perf and frames are unchanged by construction). | gate | command (from `apps/web`, `--workers=1 --retries=0`) | result | |---|---|---| | webkit-390, round 1 | `bunx playwright test e2e/a11y-high.spec.ts -g 'Style: labelled' --project=webkit-390 --repeat-each=20` (dev-02) | 20/20 | | webkit-390, round 2 | same | 20/20 | | chromium-390, round 1 | same with `--project=chromium-390` (dev-01) | 20/20 | | chromium-390, round 2 | same | 20/20 | | whole a11y-high spec, webkit-390 + webkit-1440 | `bunx playwright test e2e/a11y-high.spec.ts --project=webkit-390 --project=webkit-1440` (dev-02) | 12 passed, 4 skipped, 0 failed | | whole a11y-high spec, chromium-390 + chromium-1440 | same with chromium projects (dev-01) | 12 passed, 4 skipped, 0 failed | | `bun run check` (apps/web) | svelte-check | 0 errors, 16 warnings (same as dev) | | `bun run lint` (apps/web) | node tests + filter-motion | pass | Notes: the dev-02 runs used a dev binary built at `1e903a13a`; the dev-01 runs used the `del984-dev` binary (`db15794ac`, 11-06), because dev-01 had 55 GB free and I didn't build. The spec only seeds notes and uses the editor. The root repo has no `check`/`lint` script at the top level, so they ran in `apps/web`.
Author
Owner

Merged into dev as 98f14a3d1 (test-only). Prod is flaky the same way (19/20 vs dev 17/20), so not a release blocker; this removes the race in the test.

Merged into dev as `98f14a3d1` (test-only). Prod is flaky the same way (19/20 vs dev 17/20), so not a release blocker; this removes the race in the test.
kayg closed this pull request 2026-11-07 06:48:03 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!1001
No description provided.