Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/react/src/PageLayout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ describe('PageLayout', async () => {
expect(content!.style.getPropertyValue('contain')).toBe('')
})

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

// Start drag - will-change is added
// Start drag - will-change should still not be set (removed optimization)
fireEvent.pointerDown(divider, {clientX: 300, clientY: 200, pointerId: 1})
expect(pane!.style.willChange).toBe('width')
// End drag - will-change is removed
expect(pane!.style.willChange).toBe('')
// End drag - will-change remains unset
fireEvent.lostPointerCapture(divider, {pointerId: 1})
expect(pane!.style.willChange).toBe('')
})
Expand Down
4 changes: 1 addition & 3 deletions packages/react/src/PageLayout/paneUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function setContainmentOptimizations(element: HTMLElement | null) {
if (!element) return
element.style.contain = 'layout style paint'
element.style.contentVisibility = 'auto'
element.style.containIntrinsicSize = 'auto 500px'
element.style.containIntrinsicSize = `auto ${element.offsetHeight}px`
element.style.pointerEvents = 'none'
}

Expand All @@ -36,7 +36,6 @@ export function setDraggingStyles({handle, pane, content}: DraggingStylesParams)
handle?.style.setProperty('--draggable-handle--drag-opacity', '1')
// Disable transition for instant visual feedback during drag
handle?.style.setProperty('--draggable-handle--transition', 'none')
pane?.style.setProperty('will-change', 'width')
setContainmentOptimizations(content)
setContainmentOptimizations(pane)
}
Expand All @@ -46,7 +45,6 @@ export function removeDraggingStyles({handle, pane, content}: DraggingStylesPara
handle?.style.removeProperty('background-color')
handle?.style.removeProperty('--draggable-handle--drag-opacity')
handle?.style.removeProperty('--draggable-handle--transition')
pane?.style.removeProperty('will-change')
removeContainmentOptimizations(content)
removeContainmentOptimizations(pane)
}