Skip to content

Commit 335e9e8

Browse files
authored
Revert "Revert "Revert "Improve PageLayout pane drag performance with pointer capture and GPU-accelerated transforms""" (#7305)
1 parent 4914cb7 commit 335e9e8

File tree

6 files changed

+165
-853
lines changed

6 files changed

+165
-853
lines changed

.changeset/healthy-poets-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Revert PR #7275

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 & 61 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;
@@ -371,26 +383,6 @@
371383
}
372384
}
373385

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

@@ -417,16 +409,6 @@
417409
}
418410
}
419411

420-
/**
421-
* OPTIMIZATION: Freeze content layout during resize drag
422-
* This prevents expensive recalculations of large content areas
423-
* while keeping content visible (just frozen in place)
424-
*/
425-
.PageLayoutContent:has(.DraggableHandle[data-dragging='true']) .Content {
426-
/* Full containment (without size) - isolate from layout recalculations */
427-
contain: layout style paint;
428-
}
429-
430412
.PaneWrapper {
431413
display: flex;
432414
width: 100%;
@@ -616,26 +598,6 @@
616598
}
617599
}
618600

619-
/**
620-
* OPTIMIZATION: Performance enhancements for Pane during drag
621-
* CSS handles all optimizations automatically - JavaScript only locks scroll
622-
*/
623-
.PaneWrapper:has(.DraggableHandle[data-dragging='true']) .Pane {
624-
/* Full containment - isolate from layout recalculations */
625-
contain: layout style paint;
626-
627-
/* Disable interactions during drag */
628-
pointer-events: none;
629-
630-
/* Disable transitions during drag */
631-
transition: none;
632-
633-
/* Force hardware acceleration */
634-
will-change: width, transform;
635-
transform: translateZ(0);
636-
backface-visibility: hidden;
637-
}
638-
639601
.PaneHorizontalDivider {
640602
&:where([data-position='start']) {
641603
/* stylelint-disable-next-line primer/spacing */
@@ -734,22 +696,12 @@
734696
padding: var(--spacing);
735697
}
736698

737-
/**
738-
* DraggableHandle - Interactive resize handle
739-
*/
740699
.DraggableHandle {
741700
position: absolute;
742701
inset: 0 -2px;
743702
cursor: col-resize;
744703
background-color: transparent;
745704
transition-delay: 0.1s;
746-
747-
/**
748-
* OPTIMIZATION: Prevent touch scrolling and text selection during drag
749-
* This is done in CSS because it needs to be set before any pointer events
750-
*/
751-
touch-action: none;
752-
user-select: none;
753705
}
754706

755707
.DraggableHandle:hover {
@@ -758,7 +710,6 @@
758710

759711
.DraggableHandle[data-dragging='true'] {
760712
background-color: var(--bgColor-accent-emphasis);
761-
cursor: col-resize;
762713
}
763714

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

0 commit comments

Comments
 (0)