Skip to content

Conversation

@mattcosta7
Copy link
Contributor

@mattcosta7 mattcosta7 commented Dec 4, 2025

Reverts #7274 and reapplies #7251 with minor changes

Removes a few CSS optimizations that caused conflicts with some curent impelemtnations in projects.

we removed a couple lines of css optimization that we had added initially. Otherwise this PR is functionally the same as before - just with a few less browser rendering optimizations

.ContentWrapper {
  /**
   * OPTIMIZATION: Isolate content area from rest of page
   * Note: No 'paint' containment to allow overflow effects (tooltips, modals, etc.)
   */
-  contain: layout style;
}

.Pane {
  /**
   * OPTIMIZATION: Full containment for pane - isolates from rest of page
   */
-  contain: layout style paint;
-  content-visibility: auto;
}

.Content {
  /**
   * OPTIMIZATION: Skip rendering off-screen content during scrolling/resizing
   * This automatically helps consumers with large content by only rendering
   * elements that are visible in the viewport
   */
-  content-visibility: auto;
-  contain-intrinsic-size: auto 500px;
}

This means we lose a few browser/style optimization, but fixes an issue where some fixed position layout could be mis-attributed AFAICT this only occured in memex, in an overlay when dragging a card in an board view.

I opted to remove that optimization and instead only apply containment in cases where the page layout is actively resizing - which avoids the issue we saw here.

This is not ideal but avoids possible issues that could arise from fixed positioning internals inside of the containment space. We might revisit this later if we find it valuable to improve performance again, with a bit more nuance in the validation phase (and re-evaluating some fixed position portalling or other strategies)

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 41cb836

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
Copy link
Contributor

github-actions bot commented Dec 4, 2025

👋 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. 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 Dec 4, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-7275 December 4, 2025 22:25 Abandoned
@mattcosta7 mattcosta7 self-assigned this Dec 4, 2025
@mattcosta7 mattcosta7 marked this pull request as ready for review December 4, 2025 22:34
@mattcosta7 mattcosta7 requested a review from a team as a code owner December 4, 2025 22:34
@mattcosta7 mattcosta7 requested review from Copilot and pksjce December 4, 2025 22:34
@github-actions github-actions bot temporarily deployed to storybook-preview-7275 December 4, 2025 22:34 Inactive
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR re-applies a performance optimization for PageLayout pane dragging that was previously reverted due to layout issues in memex. The fix improves drag performance to 60fps using pointer capture and GPU-accelerated CSS transforms, while addressing the previous regression by only applying containment during active resize operations rather than globally.

Key Changes:

  • Replaces mouse events with pointer events and pointer capture for smoother drag interactions
  • Eliminates React state updates during drag by using refs and direct DOM manipulation (style.setProperty)
  • Implements shared ResizeObserver via useSyncExternalStore for efficient viewport width tracking
  • Applies CSS containment and GPU acceleration only during active drag operations using :has() selector

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
packages/react/src/PageLayout/PageLayout.tsx Core implementation: adds viewport width tracking, replaces mouse/keyboard drag with pointer events, uses DOM manipulation instead of React state for performance
packages/react/src/PageLayout/PageLayout.module.css Removes global body drag styles, adds targeted CSS optimizations (containment, GPU acceleration) only during active drag using :has() selector
packages/react/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap Updates snapshots to reflect removal of inline --pane-width style (now set via DOM manipulation)
packages/react/src/PageLayout/PageLayout.performance.stories.tsx Adds comprehensive performance test stories with varying DOM sizes (100-5000 elements) and keyboard/ARIA testing
e2e/components/Axe.test.ts Excludes performance test stories from accessibility tests (appropriate since they contain large datasets)
.changeset/olive-heads-enter.md Adds changeset for patch release documenting the performance improvement

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Dec 4, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7275 December 4, 2025 23:02 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7275 December 5, 2025 02:24 Inactive
@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Dec 5, 2025
@github-actions github-actions bot removed the integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh label Dec 5, 2025
@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/8187

@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: failing Changes in this PR cause breaking changes in gh/gh integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh labels Dec 5, 2025
@primer-integration
Copy link

🟢 ci completed with status success.

Copy link
Contributor

@llastflowers llastflowers left a comment

Choose a reason for hiding this comment

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

@mattcosta7 mattcosta7 added this pull request to the merge queue Dec 5, 2025
Merged via the queue into main with commit 822c3e7 Dec 5, 2025
51 checks passed
@mattcosta7 mattcosta7 deleted the revert-7274-revert-7251-mc/copilot/sub-pr-7248 branch December 5, 2025 19:12
@primer primer bot mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants