Skip to content

Commit d1fecff

Browse files
committed
Revert "Improve PageLayout pane drag performance with pointer capture and GPU-accelerated transforms (#7251)"
This reverts commit 12e12f5.
1 parent a91b9c8 commit d1fecff

File tree

5 files changed

+160
-876
lines changed

5 files changed

+160
-876
lines changed

e2e/components/Axe.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ const SKIPPED_TESTS = [
1414
'components-flash-features--with-icon-action-dismiss', // TODO: Remove once color-contrast issues have been resolved
1515
'components-flash-features--with-icon-and-action', // TODO: Remove once color-contrast issues have been resolved
1616
'components-filteredactionlist--default',
17-
'components-pagelayout-performance-tests--medium-content',
18-
'components-pagelayout-performance-tests--heavy-content',
1917
]
2018

2119
type Component = {

packages/react/src/PageLayout/PageLayout.module.css

Lines changed: 12 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/* Maintain resize cursor while dragging */
2+
/* stylelint-disable-next-line selector-no-qualifying-type */
3+
body[data-page-layout-dragging='true'] {
4+
cursor: col-resize;
5+
}
6+
7+
/* Disable text selection while dragging */
8+
/* stylelint-disable-next-line selector-no-qualifying-type */
9+
body[data-page-layout-dragging='true'] * {
10+
user-select: none;
11+
}
12+
113
.PageLayoutRoot {
214
/* Region Order */
315
--region-order-header: 0;
@@ -345,12 +357,6 @@
345357
flex-grow: 1;
346358
flex-shrink: 1;
347359

348-
/**
349-
* OPTIMIZATION: Isolate content area from rest of page
350-
* Note: No 'paint' containment to allow overflow effects (tooltips, modals, etc.)
351-
*/
352-
contain: layout style;
353-
354360
&:where([data-is-hidden='true']) {
355361
display: none;
356362
}
@@ -377,26 +383,6 @@
377383
}
378384
}
379385

380-
/**
381-
* OPTIMIZATION: Aggressive containment during drag for ContentWrapper
382-
* CSS handles most optimizations automatically via :has() selector
383-
* JavaScript only handles scroll locking (can't be done in CSS)
384-
*/
385-
.PageLayoutContent:has(.DraggableHandle[data-dragging='true']) .ContentWrapper {
386-
/* Add paint containment during drag - safe since user can't interact */
387-
contain: layout style paint;
388-
389-
/* Disable interactions */
390-
pointer-events: none;
391-
392-
/* Disable transitions to prevent expensive recalculations */
393-
transition: none;
394-
395-
/* Force compositor layer for hardware acceleration */
396-
will-change: width;
397-
transform: translateZ(0);
398-
}
399-
400386
.Content {
401387
width: 100%;
402388

@@ -406,14 +392,6 @@
406392
margin-left: auto;
407393
flex-grow: 1;
408394

409-
/**
410-
* OPTIMIZATION: Skip rendering off-screen content during scrolling/resizing
411-
* This automatically helps consumers with large content by only rendering
412-
* elements that are visible in the viewport
413-
*/
414-
content-visibility: auto;
415-
contain-intrinsic-size: auto 500px;
416-
417395
&:where([data-width='medium']) {
418396
max-width: 768px;
419397
}
@@ -431,16 +409,6 @@
431409
}
432410
}
433411

434-
/**
435-
* OPTIMIZATION: Freeze content layout during resize drag
436-
* This prevents expensive recalculations of large content areas
437-
* while keeping content visible (just frozen in place)
438-
*/
439-
.PageLayoutContent:has(.DraggableHandle[data-dragging='true']) .Content {
440-
/* Full containment (without size) - isolate from layout recalculations */
441-
contain: layout style paint;
442-
}
443-
444412
.PaneWrapper {
445413
display: flex;
446414
width: 100%;
@@ -617,15 +585,6 @@
617585
/* stylelint-disable-next-line primer/spacing */
618586
padding: var(--spacing);
619587

620-
/**
621-
* OPTIMIZATION: Full containment for pane - isolates from rest of page
622-
*/
623-
contain: layout style paint;
624-
/**
625-
* OPTIMIZATION: For extremely tall content - skip rendering off-screen content
626-
*/
627-
content-visibility: auto;
628-
629588
@media screen and (min-width: 768px) {
630589
overflow: auto;
631590
}
@@ -639,26 +598,6 @@
639598
}
640599
}
641600

642-
/**
643-
* OPTIMIZATION: Performance enhancements for Pane during drag
644-
* CSS handles all optimizations automatically - JavaScript only locks scroll
645-
*/
646-
.PaneWrapper:has(.DraggableHandle[data-dragging='true']) .Pane {
647-
/* Full containment - isolate from layout recalculations */
648-
contain: layout style paint;
649-
650-
/* Disable interactions during drag */
651-
pointer-events: none;
652-
653-
/* Disable transitions during drag */
654-
transition: none;
655-
656-
/* Force hardware acceleration */
657-
will-change: width, transform;
658-
transform: translateZ(0);
659-
backface-visibility: hidden;
660-
}
661-
662601
.PaneHorizontalDivider {
663602
&:where([data-position='start']) {
664603
/* stylelint-disable-next-line primer/spacing */
@@ -757,22 +696,12 @@
757696
padding: var(--spacing);
758697
}
759698

760-
/**
761-
* DraggableHandle - Interactive resize handle
762-
*/
763699
.DraggableHandle {
764700
position: absolute;
765701
inset: 0 -2px;
766702
cursor: col-resize;
767703
background-color: transparent;
768704
transition-delay: 0.1s;
769-
770-
/**
771-
* OPTIMIZATION: Prevent touch scrolling and text selection during drag
772-
* This is done in CSS because it needs to be set before any pointer events
773-
*/
774-
touch-action: none;
775-
user-select: none;
776705
}
777706

778707
.DraggableHandle:hover {
@@ -781,7 +710,6 @@
781710

782711
.DraggableHandle[data-dragging='true'] {
783712
background-color: var(--bgColor-accent-emphasis);
784-
cursor: col-resize;
785713
}
786714

787715
.DraggableHandle[data-dragging='true']:hover {

0 commit comments

Comments
 (0)