Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(site/src/pages/AgentsPage): end resize drags on pointercancel and lostpointercapture - #29156

Merged
jscottmiller merged 5 commits into
mainfrom
scott/shelf-resize-bug
Sep 11, 2026
Merged

fix(site/src/pages/AgentsPage): end resize drags on pointercancel and lostpointercapture#29156
jscottmiller merged 5 commits into
mainfrom
scott/shelf-resize-bug

Conversation

@jscottmiller

@jscottmiller jscottmiller commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

If a resize drag on the right shelf is interrupted (window loses focus, or a secondary button opens a context menu mid-drag), the shelf stays hidden and the top-bar toggle does nothing until the user navigates away and back.

RightPanel previews the drag result through a dragSnap override that only pointerup cleared. Chromium ends an interrupted drag with lostpointercapture and no pointerup, so the override stayed pinned at "closed" and the panel ignored isOpen until the chat view remounted.

pointerup, pointercancel and lostpointercapture now share one finalisation path. A release commits the snap; the other two clear the override, reset the parent's live-expanded state and undo a sidebar collapse the drag caused, without committing. The snap is mirrored in a ref so a release that lands before the last pointermove renders commits the right zone, pointerdown ignores non-primary pointers, secondary buttons and re-entry, and the handle gets touch-action: none.

Behaviour is covered in RightPanel.test.tsx through a harness that owns the surrounding state and asserts callback payloads and the persisted width; 7 of 12 tests fail with the fix reverted. No stories were added: every end state after a drag renders identically to the existing Default, Closed or Expanded story. The real trigger was reproduced in headed Chromium under Xvfb with X11 input.

The left sidebar handle in ResizableChatsSidebarFrame gets the same hardening (lostpointercapture, pointer guards) with 6 tests in ResizableChatsSidebarFrame.test.tsx; it had no visible bug since it has no snap states, but it stayed in drag mode after an interrupted drag.

The handle keeps a data-testid rather than role="separator": Biome rejects a non-focusable separator, and a focusable one without keyboard resizing would be a dead tab stop.


Generated by Coder Agents on behalf of @jscottmiller.

…ag finalisation

Move the pointerup teardown into finishDrag so other terminal pointer
events can share it. Use currentTarget instead of casting target and
release capture only while it is held. No behaviour change.
…intercancel and lostpointercapture

When Chromium releases mouse capture mid-drag (window deactivated,
native context menu) it fires lostpointercapture with no pointerup.
The drag override that hides or expands the panel during a drag was
only cleared on pointerup, so it stayed pinned: the panel remained
display:none and the top-bar toggle had no visible effect until the
chat view remounted.

Handle pointercancel and lostpointercapture as an abort that clears
the override, notifies the parent, and undoes a drag-induced sidebar
collapse without committing the snap. Read the snap from a ref so a
pointerup landing before the last pointermove renders commits the
zone the pointer actually ended in. Ignore non-primary and
non-left-button pointerdowns, check the pointer id on move and end,
and set touch-action: none on the handle.
…ted resize drags

Add a test id to the drag handle and Vitest coverage that drives drags
ending in lostpointercapture, pointercancel or pointerup through a
harness owning the open, expanded and sidebar-collapse state, asserting
the resulting state callbacks and persisted width.
…ostpointercapture

Mirror the right panel drag hardening in the left sidebar resize handle:
end the drag on lostpointercapture, and only let a primary left-button
pointer start or end a drag.
@jscottmiller
jscottmiller marked this pull request as ready for review September 10, 2026 19:26
@jscottmiller jscottmiller changed the title fix(site/src/pages/AgentsPage/components/RightPanel): end drag on pointercancel and lostpointercapture fix: end drag on pointercancel and lostpointercapture Sep 10, 2026
…as primary

The sidebar resize handle ignores non-primary pointers, and synthetic
PointerEvent init defaults isPrimary to false.
@jscottmiller jscottmiller changed the title fix: end drag on pointercancel and lostpointercapture fix(site/src/pages/AgentsPage): end resize drags on pointercancel and lostpointercapture Sep 10, 2026
@jscottmiller
jscottmiller merged commit 5e058aa into main Sep 11, 2026
30 checks passed
@jscottmiller
jscottmiller deleted the scott/shelf-resize-bug branch September 11, 2026 17:53
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants