Fix PageLayout pane layout shift when content loads asynchronously#7711
Fix PageLayout pane layout shift when content loads asynchronously#7711
Conversation
|
|
|
Uh oh! @jonrohan, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:
Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
Closes https://github.com/github/pull-requests/issues/23557
Overview
Fixes a subtle layout shift on pages using
PageLayout.Panewhere the sidebar content is loaded asynchronously. When the pane content rendered after the initial load, the page would visibly jump because thePaneWrapperelement hadwidth: autoand didn't reserve space for the pane.Root cause: The pane width CSS custom properties (
--pane-width-size,--pane-min-width,--pane-max-width, etc.) were set on the inner pane element rather than the outerPaneWrapper. This meant the wrapper couldn't use them to reserve the correct width before pane content loaded.Fix:
divup to thePaneWrapperelementPaneWrapperfromwidth: autotowidth: var(--pane-width-size)so it reserves the correct pane width immediately, preventing layout reflow when content loads inChangelog
New
Changed
PageLayout.Pane: Pane width CSS variables are now set on thePaneWrapperelement instead of the inner pane div, and the wrapper width usesvar(--pane-width-size)instead ofautoRemoved
Rollout strategy
Testing & Reviewing
PageLayoutwith aPanethat loads its content asynchronously (e.g., viauseEffector data fetching)small,medium,large, and custom) still render correctlyMerge checklist