Skip to content

perf: add contain:layout to high-churn overflow containers#8166

Merged
mattcosta7 merged 3 commits into
mainfrom
perf/contain-layout-high-churn
Jul 16, 2026
Merged

perf: add contain:layout to high-churn overflow containers#8166
mattcosta7 merged 3 commits into
mainfrom
perf/contain-layout-high-churn

Conversation

@mattcosta7

@mattcosta7 mattcosta7 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #

Applies CSS contain: layout to a handful of high-churn overflow containers so their frequent, resize/observer-driven reflows are isolated to their own subtree and can no longer invalidate ancestor layout. This mirrors the existing contain: layout style paint pattern already used by PageLayout during drag/resize.

Changelog

Changed

  • ActionBar (.List + .OverflowContainer): scroll-timeline overflow detection + JS visibility toggling are now contained.
  • UnderlineNav / UnderlinePanels (shared .UnderlineItemList): ResizeObserver-driven item swapping into the overflow menu is now contained.
  • LabelGroup (.Container): IntersectionObserver-driven show/hide of overflowing labels is now contained.

All targets already set overflow: hidden and their overlays/menus are portaled or rendered separately, so the new containing block/stacking context has no visual effect. contain: paint was intentionally not used (no clipping), and contain: size was avoided so elements still size to content.

New

None

Removed

None

Rollout strategy

  • Patch release

Testing & Reviewing

Pure CSS containment change. Unit tests for ActionBar, UnderlineNav, and LabelGroup pass. Because containment establishes new stacking/containing-block contexts, this should get a visual regression (@vrt) pass on ActionBar, UnderlineNav, UnderlinePanels, and LabelGroup — verifying overflow menus and expanded label overlays still render outside their containers.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github-ui

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39ac2c6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

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

@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 Jul 15, 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. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@mattcosta7 mattcosta7 self-assigned this Jul 15, 2026
@mattcosta7 mattcosta7 added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jul 15, 2026
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8166 July 15, 2026 11:47 Inactive
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

@mattcosta7
mattcosta7 marked this pull request as ready for review July 15, 2026 13:07
@mattcosta7
mattcosta7 requested a review from a team as a code owner July 15, 2026 13:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Applies CSS contain: layout to a few high-churn, overflow-related containers in @primer/react to isolate frequent reflows (ResizeObserver/IntersectionObserver/overflow-driven UI) and reduce ancestor layout invalidation.

Changes:

  • Add contain: layout to ActionBar list + overflow container to contain wrap/measure churn.
  • Add contain: layout to the shared underline tab item list used by UnderlineNav and UnderlinePanels.
  • Add contain: layout to LabelGroup container to contain IntersectionObserver-driven show/hide churn, plus a patch changeset.
Show a summary per file
File Description
packages/react/src/ActionBar/ActionBar.module.css Adds layout containment to overflow-detection/wrapping containers to isolate reflows.
packages/react/src/internal/components/UnderlineTabbedInterface.module.css Adds layout containment to the underline tab list to isolate ResizeObserver-driven layout churn.
packages/react/src/LabelGroup/LabelGroup.module.css Adds layout containment to the label row to isolate IntersectionObserver-driven visibility changes.
.changeset/contain-layout-high-churn.md Patch changeset documenting the containment update across components.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Low

@mattcosta7
mattcosta7 requested a review from jonrohan July 15, 2026 13:21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mattcosta7
mattcosta7 enabled auto-merge July 16, 2026 03:17
@mattcosta7 mattcosta7 added the integration-tests: skipped manually Changes in this PR do not require an integration test label Jul 16, 2026
@mattcosta7
mattcosta7 added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit 4045abe Jul 16, 2026
61 checks passed
@mattcosta7
mattcosta7 deleted the perf/contain-layout-high-churn branch July 16, 2026 03:27
@primer primer Bot mentioned this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm integration-tests: skipped manually Changes in this PR do not require an integration test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants