fix: bottom-strip drag no longer leaks the panel width into the host layout

The bottom drag applied the panel's persisted width preference to
--dsh-sidebar-width regardless of panelOpen (only the idle push effect
gated it through layoutPushSize). With the right panel closed, the
first drag frame jumped the variable 0 → ~400px: #root lost 400px
instantly, the host frame's viewport dropped across its 1024px
auto-collapse breakpoint, and the NATIVE left sidebar snapped to its
56px rail — then snapped back on release. The bottom strip is the only
drag reachable with the panel closed, which is why only it showed.

applyDrag now rides the same gate as the push effect for the PUSHED
width; the panel-side DOM writes (panelRef/bottomRef/lastDragSize)
keep the raw width — the bottom panel's right edge derives from it.

The e2e regression pins the pose: panel closed + bottom open, drag the
strip, and every sampled frame must keep the pushed width at 0, the
host grid template, the left column width and #root's right edge
unchanged. Verified red on the old code (leaked 504px).
This commit is contained in:
Menghuan1918
2026-09-01 15:58:44 +08:00
parent c1992125d0
commit 659c2a20e2
2 changed files with 145 additions and 1 deletions
+8 -1
View File
@@ -993,7 +993,14 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
// drag write-only (no React re-render mid-drag).
bottomRef.current?.style.setProperty('right', `${(window.innerWidth - centerRectRef.current.right) + (width - (state?.width ?? 0))}px`)
const bottomPush = !narrow && state?.bottomOpen === true ? height + keyboardInset : 0
writeGeometry(width, bottomPush)
// The pushed width must ride the same gate as the committed push effect
// (layoutPushSize): a collapsed right panel pushes 0. The bottom strip is
// the only drag reachable with the panel closed — writing the panel's
// persisted width preference here squeezed #root mid-drag, dropped the
// host viewport across its 1024px auto-collapse breakpoint, and the
// native left sidebar snapped to its 56px rail (and back on release).
const pushWidth = !narrow && state?.panelOpen === true ? Math.min(width, window.innerWidth) : 0
writeGeometry(pushWidth, bottomPush)
}
// Drags write at most once per frame: pointer events fire several times