Repository navigation
Conversation
observeMainOverflow starts where a scroll container's ref attaches, inside React's commit. It measured there at once, and it read document.fonts.ready, which updates style and layout in Chromium. When a Dialog mounts its body as it opens, both reads forced a style and layout pass on the closed dialog, before showModal() restyles it. The first measurement now waits for the first resize notification, which comes after the browser lays main or a child out (observeResizeAfterLayout). Until then no other signal reads layout. A font that loads later still starts a measurement through the loadingdone event. Where no ResizeObserver exists, main is measured at once, as before. The region's group role and name, and AppShell main's tab stop, now arrive with that first notification instead of during the commit.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
Contributor
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
Contributor
|
/approve-spec 667d520 |
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.
Primary intent
Performance: a scroll region stops forcing a style and layout pass as it attaches. Nothing renders wrong (not a bug fix), and one product timing moves (not maintenance).
User or maintainer impact
A tap can mount a scrolling
LayoutContent,LayoutPanelorStackItem, or AppShell's main underheight="fill". The overflow observer then forces a style recalc and a layout inside React's commit. A product app's panel-open trace showed this pass.Chromium, production Storybook builds, 4× CPU, 390×844 (test; median of 10 runs; stack-attributed):
In the Dialog case, Dialog's own trigger read before
showModal()then pays most of that pass (22.6 ms). This PR leaves Dialog unchanged.Problem and solution fit
observeMainOverflowmeasured synchronously in the ref callback:getComputedStyle(main)and scroll geometry. It also readdocument.fonts.ready, which updates style and layout in Chromium.The change:
observeResizeAfterLayouton main and each direct child). No signal reads layout before it.fonts.readyread goes. Theloadingdonelistener still catches a late font.ResizeObserver, main is measured at once, as before.Authority
architecture:react-component-runtimeINV18: withobserveResizeAfterLayout, "a caller's first read comes from the browser's own first notification after layout".component:LayoutContentAR3,component:LayoutPanelAR3,component:StackAR2, andcomponent:AppShellFR4 throughspec:AST-025FR12. No record requires them at mount, first paint or hydration, so no record changes.observeMainOverflowis internal. Its signature is unchanged.Behavior change
The role and name, and AppShell main's tab stop, arrive 2–3 frames after the tap (median 2), after first paint, in 10 of 10 runs.
Owner question (proposed; pending owner review)
AppShell main's tab stop also moves to the first notification, because AppShell and the scroll regions share
observeMainOverflow. Is that acceptable? If not, a variant limits the new timing touseScrollRegionProps.Follow-up (not in this PR)
useScrollableAreaalso readsfonts.readyin a layout effect. For dialogs, Dialog's trigger read remains.Scope
Components: AppShell (
observeMainOverflow), LayoutContent, LayoutPanel, StackItem (throughuseScrollRegionProps)Testing
observeMainOverflow.test.tsgains three cases. On main all three fail: it readsgetComputedStyleas it starts, it reads layout on a signal before the first notification, and it readsfonts.ready. With this change all 10 cases pass. AppShell's keyboard tests now send the browser's notification before they expect the tab stop.pnpm test:ui: 1,091 files, 26,585 tests pass.pnpm -F @astryxdesign/core typecheckpasses.scrollRegionName,ContainerBlockBleed,MobileNavLandmark,AppShellMainKeyboard,AppShellSafeArea,LayoutContentAudit,LayoutPanelAudit.collapsedPanelandAppShellLayoutRoot: Chromium 4 of 4, WebKit 4 of 4.AppShellMainKeyboardin WebKit: 15 pass, 1 skipped.pnpm review:pre: 0 findings. Lint, Prettier andcheck:changesetspass.