Repository navigation
fix(ResizeHandle): keep the drag when the cursor crosses an embedded frame - #5297
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f8f9448 to
6712585
Compare
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsResizable (@astryxdesign/core) · View in Storybook
SideNav (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression126 added · 0 removed. View the report To accept these exact frames: Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…frame The handle listened for pointermove/pointerup on window without taking pointer capture, so the browser hit-tested every later event and an iframe inside the resizable region swallowed the rest of the gesture into its own document. Take capture on the grab zone at pointerdown and deliver the move/up/cancel handlers there, as Slider and BottomSheet do.
6712585 to
d023d97
Compare
|
/accept-visual |
|
Visual acceptance refused: copy the exact |
|
/accept-visual 33335001095/1 Expected ResizeHandle pointer-capture coverage. |
|
Visual changes accepted for |



Why
ResizeHandlestarted a drag onpointerdownand then listened onwindowforpointermove/pointerup, without ever callingsetPointerCapture. Withoutcapture the browser hit-tests every later pointer event, so the moment the
cursor crosses an
<iframe>inside the resizable region those events aredispatched into the guest document and the host window listener stops
hearing them. The drag dies mid-gesture while still looking armed. It bites any
consumer whose resizable region can contain a frame — a preview pane, an
embedded app.
The cursor leaves the handle more often than it sounds: the divider only tracks
the pointer while the panel can still follow it, so any drag past
maxSizePx(or down to
minSizePx, or faster than layout) puts the pointer over thecontent pane.
Measured
New story
Lab/Resizable → WithEmbeddedFrame, driven in Chromium withPlaywright: press on the handle, drag right until the panel hits its 520px max,
keep going 25 × 8px so the cursor is genuinely over the frame, release there.
pointerupheard by the hostdata-resizingafter releasecursor/user-selectafter releasecol-resize/noneThe panel never moves at all in the "before" column because the grab zone is
biased onto the pill on the panel side, so the very first move of the drag
already lands the cursor over the frame.
What
pointerdownnow takes pointer capture on the grab zone, and themove/up/cancel handlers moved onto that element.
Where the listeners went, and why. A captured pointer's events are
delivered to the capturing element and then bubble, so listeners on the element
and listeners on
windowwould both fire — keeping both would double-handle,and keeping only
windowwould leave the drag at the mercy of anystopPropagationbetween the handle and the top. They live on the element, thesame shape as
SliderandBottomSheet.Three behaviors the old code had, and where they went:
pointer and takes React's listeners with it, so an in-flight drag stops
driving the region on its own; the unmount effect stays only to release the
body
cursor/user-selectoverrides, which do not live on the element.pointercancel. Still ends the drag without signalling a resize end.lostpointercaptureroutes to the same path — it also fires on the implicitrelease after every
pointerup/pointercancel, by which point the drag isalready cleared and it is a no-op.
from a pointer that does not own the drag.
No API change; keyboard resizing, RTL delta mapping and the grab-zone geometry
are untouched.
Testing
ResizeHandle.test.tsxcovers capture taken onpointerdown, the drag drivenand ended from the element,
pointercancel/lostpointercaptureteardown,foreign-pointer moves ignored, and unmount mid-drag. One
SideNavtest neededupdating — it dispatched its synthetic drag at
document. Fullpackages/coresuite, typecheck and lint pass.
Adjacent, not touched here
Two other drags in core hold the same window-listener shape and will drop the
same way over a frame:
useTableColumnResizeand theLightboxpan. Leftalone so this stays one component — worth asking separately whether they should
all share one drag hook.