Skip to content

Fix PageLayout pane layout shift when content loads asynchronously#7711

Draft
jonrohan wants to merge 2 commits intomainfrom
pagelayout_empty_pane_bug
Draft

Fix PageLayout pane layout shift when content loads asynchronously#7711
jonrohan wants to merge 2 commits intomainfrom
pagelayout_empty_pane_bug

Conversation

@jonrohan
Copy link
Copy Markdown
Member

@jonrohan jonrohan commented Mar 27, 2026

Closes https://github.com/github/pull-requests/issues/23557

Before After
CleanShot 2026-03-27 at 13 04 28 CleanShot 2026-03-27 at 13 04 48

Overview

Fixes a subtle layout shift on pages using PageLayout.Pane where the sidebar content is loaded asynchronously. When the pane content rendered after the initial load, the page would visibly jump because the PaneWrapper element had width: auto and 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 outer PaneWrapper. This meant the wrapper couldn't use them to reserve the correct width before pane content loaded.

Fix:

  • Moved the pane width CSS custom properties from the inner pane div up to the PaneWrapper element
  • Changed PaneWrapper from width: auto to width: var(--pane-width-size) so it reserves the correct pane width immediately, preventing layout reflow when content loads in

Changelog

New

Changed

  • PageLayout.Pane: Pane width CSS variables are now set on the PaneWrapper element instead of the inner pane div, and the wrapper width uses var(--pane-width-size) instead of auto

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  1. Use a PageLayout with a Pane that loads its content asynchronously (e.g., via useEffect or data fetching)
  2. Observe that the page no longer shifts/jumps when the pane content appears
  3. Verify that pane widths (small, medium, large, and custom) still render correctly

Merge checklist

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 27, 2026

⚠️ No Changeset found

Latest commit: c4ad237

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the staff Author is a staff member label Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Uh oh! @jonrohan, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 9
  • Images should have meaningful alternative text (alt text) at line 9

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.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant