Skip to content

Commit ef70170

Browse files
Copilotmattcosta7
andcommitted
Remove will-change: width and use actual element height in paneUtils
- Removed will-change: width from setDraggingStyles/removeDraggingStyles as it provides no benefit for layout properties - Updated containIntrinsicSize to use element.offsetHeight instead of hardcoded 500px to prevent layout shift - Updated test to verify will-change is no longer set during drag operations Co-authored-by: mattcosta7 <[email protected]>
1 parent 0259ef2 commit ef70170

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/react/src/PageLayout/PageLayout.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ describe('PageLayout', async () => {
234234
expect(content!.style.getPropertyValue('contain')).toBe('')
235235
})
236236

237-
it('should add will-change during drag for optimized updates', async () => {
237+
it('should not add will-change during drag', async () => {
238238
const {container} = render(
239239
<PageLayout>
240240
<PageLayout.Pane resizable>
@@ -252,10 +252,10 @@ describe('PageLayout', async () => {
252252
// Before drag - no will-change
253253
expect(pane!.style.willChange).toBe('')
254254

255-
// Start drag - will-change is added
255+
// Start drag - will-change should still not be set (removed optimization)
256256
fireEvent.pointerDown(divider, {clientX: 300, clientY: 200, pointerId: 1})
257-
expect(pane!.style.willChange).toBe('width')
258-
// End drag - will-change is removed
257+
expect(pane!.style.willChange).toBe('')
258+
// End drag - will-change remains unset
259259
fireEvent.lostPointerCapture(divider, {pointerId: 1})
260260
expect(pane!.style.willChange).toBe('')
261261
})

packages/react/src/PageLayout/paneUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function setContainmentOptimizations(element: HTMLElement | null) {
99
if (!element) return
1010
element.style.contain = 'layout style paint'
1111
element.style.contentVisibility = 'auto'
12-
element.style.containIntrinsicSize = 'auto 500px'
12+
element.style.containIntrinsicSize = `auto ${element.offsetHeight}px`
1313
element.style.pointerEvents = 'none'
1414
}
1515

@@ -36,7 +36,6 @@ export function setDraggingStyles({handle, pane, content}: DraggingStylesParams)
3636
handle?.style.setProperty('--draggable-handle--drag-opacity', '1')
3737
// Disable transition for instant visual feedback during drag
3838
handle?.style.setProperty('--draggable-handle--transition', 'none')
39-
pane?.style.setProperty('will-change', 'width')
4039
setContainmentOptimizations(content)
4140
setContainmentOptimizations(pane)
4241
}
@@ -46,7 +45,6 @@ export function removeDraggingStyles({handle, pane, content}: DraggingStylesPara
4645
handle?.style.removeProperty('background-color')
4746
handle?.style.removeProperty('--draggable-handle--drag-opacity')
4847
handle?.style.removeProperty('--draggable-handle--transition')
49-
pane?.style.removeProperty('will-change')
5048
removeContainmentOptimizations(content)
5149
removeContainmentOptimizations(pane)
5250
}

0 commit comments

Comments
 (0)