perf: add contain:layout to high-churn overflow containers#8166
Conversation
🦋 Changeset detectedLatest commit: 39ac2c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
|
Integration test results from github/github-ui PR:
All checks passed! |
There was a problem hiding this comment.
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: layouttoActionBarlist + overflow container to contain wrap/measure churn. - Add
contain: layoutto the shared underline tab item list used byUnderlineNavandUnderlinePanels. - Add
contain: layouttoLabelGroupcontainer 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
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Closes #
Applies CSS
contain: layoutto 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 existingcontain: layout style paintpattern already used byPageLayoutduring 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: hiddenand their overlays/menus are portaled or rendered separately, so the new containing block/stacking context has no visual effect.contain: paintwas intentionally not used (no clipping), andcontain: sizewas avoided so elements still size to content.New
None
Removed
None
Rollout strategy
Testing & Reviewing
Pure CSS containment change. Unit tests for
ActionBar,UnderlineNav, andLabelGrouppass. 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