Skip to content

Commit 5009206

Browse files
Copilotmattcosta7
andauthored
[WIP] Update drag/resize performance in PageLayout based on feedback (#7390)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: mattcosta7 <[email protected]>
1 parent ad5b3c7 commit 5009206

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,8 @@
715715
content: '';
716716
position: absolute;
717717
inset: 0;
718-
background-color: var(--bgColor-neutral-muted);
718+
/* stylelint-disable-next-line primer/colors */
719+
background-color: var(--draggable-handle--bg-color, var(--bgColor-neutral-muted));
719720
opacity: var(--draggable-handle--drag-opacity, 0);
720721
transition: var(--draggable-handle--transition, opacity 150ms ease); /* compositor-friendly, disabled during drag */
721722
border-radius: inherit; /* optional if you need rounded corners */

packages/react/src/PageLayout/paneUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const DATA_DRAGGING_ATTR = 'data-dragging'
99
/** Apply visual feedback and performance optimizations during drag */
1010
export function setDraggingStyles({handle, pane, content}: DraggingStylesParams) {
1111
// Handle visual feedback (must be inline for instant response)
12-
handle?.style.setProperty('background-color', 'var(--bgColor-accent-emphasis)')
12+
// Use CSS variable to control ::before pseudo-element background color.
13+
// This avoids cascade conflicts between inline styles and pseudo-element backgrounds.
14+
handle?.style.setProperty('--draggable-handle--bg-color', 'var(--bgColor-accent-emphasis)')
1315
handle?.style.setProperty('--draggable-handle--drag-opacity', '1')
1416
handle?.style.setProperty('--draggable-handle--transition', 'none')
1517

@@ -20,7 +22,7 @@ export function setDraggingStyles({handle, pane, content}: DraggingStylesParams)
2022

2123
/** Remove drag styles and restore normal state */
2224
export function removeDraggingStyles({handle, pane, content}: DraggingStylesParams) {
23-
handle?.style.removeProperty('background-color')
25+
handle?.style.removeProperty('--draggable-handle--bg-color')
2426
handle?.style.removeProperty('--draggable-handle--drag-opacity')
2527
handle?.style.removeProperty('--draggable-handle--transition')
2628

0 commit comments

Comments
 (0)