fix: reserve keyboard inset in layout push
This commit is contained in:
@@ -694,7 +694,8 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
// `width + detailsWidth` — derived from the measured column, keeping the
|
||||
// drag write-only (no React re-render mid-drag).
|
||||
bottomRef.current?.style.setProperty('right', `${(window.innerWidth - centerRect.right) + (width - (state?.width ?? 0))}px`)
|
||||
writeGeometry(width, height)
|
||||
const bottomPush = !narrow && state?.bottomOpen === true ? height + keyboardInset : 0
|
||||
writeGeometry(width, bottomPush)
|
||||
}
|
||||
|
||||
// Drags write at most once per frame: pointer events fire several times
|
||||
@@ -855,8 +856,11 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
viewportWidth: viewport.width,
|
||||
viewportHeight: layoutViewportHeight,
|
||||
})
|
||||
writeGeometry(width, height)
|
||||
}, [narrow, snapshot.state?.panelOpen, snapshot.state?.width, snapshot.state?.bottomOpen, snapshot.state?.bottomHeight, viewport.width, layoutViewportHeight])
|
||||
const bottomPush = !narrow && snapshot.state?.bottomOpen === true
|
||||
? height + keyboardInset
|
||||
: 0
|
||||
writeGeometry(width, bottomPush)
|
||||
}, [narrow, snapshot.state?.panelOpen, snapshot.state?.width, snapshot.state?.bottomOpen, snapshot.state?.bottomHeight, viewport.width, layoutViewportHeight, keyboardInset])
|
||||
// Unmount must release the push (issue #31): when the boundary swaps the
|
||||
// whole sidebar after a render crash (or the plugin fiber is disposed /
|
||||
// HMR), the CSS variables would otherwise stay on <html> and layout.css
|
||||
|
||||
@@ -13,7 +13,13 @@ describe('Sidebar layout-push integration', () => {
|
||||
expect(source).toContain('setVisualViewportHeight(Math.max(0, Math.round(vv.height)))')
|
||||
expect(source).toContain('visualViewportHeight ?? viewport.height')
|
||||
expect(source.match(/viewportHeight: layoutViewportHeight/g)).toHaveLength(4)
|
||||
expect(source).toContain('viewport.width, layoutViewportHeight]')
|
||||
expect(source).toContain('viewport.width, layoutViewportHeight, keyboardInset]')
|
||||
})
|
||||
|
||||
it('adds the keyboard inset to the conversation push, not the panel height', () => {
|
||||
expect(source.match(/height \+ keyboardInset/g)).toHaveLength(2)
|
||||
expect(source).toContain('height: bottomPanelHeight')
|
||||
expect(source).not.toContain('height: bottomPanelHeight + keyboardInset')
|
||||
})
|
||||
|
||||
it('reapplies the visible-height cap to every vertical drag result', () => {
|
||||
|
||||
Reference in New Issue
Block a user