Registry Mirror
Skip to content

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Two flaky Inbox e2e checks.

inbox-html-links.spec.ts:153: a real product race. Opening a page that an attached HTML page links to moved focus to the new page's Back button in a requestAnimationFrame queued beside the state update. If that frame ran before React drew the page, it found no button and focus stayed where it was. Focus now moves in a layout effect, after the commit that draws Back. This also covers a second linked page, where the same button stays mounted. The e2e assertion stays strict.

New DOM test in packages/inbox/htmlLinks.test.tsx: frames run as soon as they are requested, ahead of React's commit. It fails on main (timed out waiting for focus on Back) and passes with this change. Under Linux with 1 CPU, inbox-html-links.spec.ts passed 35 of 35 (--repeat-each 5).

inbox-mobile.spec.ts:745 (iPad portrait): the test, in its own commit. The spec samples frames for 900 ms while the sidebar springs open and required more than 10 samples. WebKit on a loaded runner drew 7. It now records each sample's time and waits until the sampling reached 900 ms. Passed 5 of 5 under Linux with 1 CPU.

ramos-plannotator and others added 5 commits October 20, 2026 15:04
Opening a page an attached HTML page links to moved focus to its Back
button in a requestAnimationFrame queued beside the state update. A frame
that ran before React committed the page found no button, and focus stayed
behind (inbox-html-links.spec.ts failed on this about one run in three).
Focus Back from a layout effect after the commit that draws it. The DOM
test runs frames ahead of React's commit; it fails on the old code.
…count

WebKit on a loaded runner drew 7 frames in the 900 ms the spec samples
while the sidebar springs open, and the guard asked for more than 10.
Record each sample's time and wait until the sampling reached 900 ms.
…ved to

Back is focused once the linked page is drawn, which can be well after it
was read (a deep link or reload names it before the file's view is read).
Skip the focus when focus is in an editable field (the reply box), and
clear the pending focus when the linked request goes away. The DOM test
holds the file's view, types into the reply box, then lets the page draw.
…us-merge

# Conflicts:
#	packages/inbox/htmlLinks.test.tsx
@backnotprop
backnotprop merged commit 7942fe3 into main Oct 20, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants