Conversation
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
1 task
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.
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 arequestAnimationFramequeued 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.tspassed 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.