Repository navigation
fix(Slider): hold the lost-capture document listener only during a drag - #8284
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
Looks good to merge: the lost-capture listener now lives only for the drag, and drags end exactly as before. The new test fails on main and catches either cleanup being removed, and in Chromium idle sliders hold no document listener while drag results, including the FormLayout node replacement from #8152, match main. As a separate follow-up, a control node replaced before the browser has applied pointer capture fires no lostpointercapture, so that release reports no onChangeEnd; main behaves the same.
[Automated review]
Follow-up to #8152.
User impact
Every Slider on a page, desktop included, kept a document-level
lostpointercapturelistener for as long as it was mounted, although the listener only matters while a drag is in progress. A page with many sliders paid for that many always-on document listeners, and each one ran on every capture loss anywhere on the page. After this change the listener exists only for the duration of a drag. Dragging behaves exactly as before, including the case #8152 fixed: when the control node is replaced mid-drag (a FormLayout direction change), losing the capture still ends the drag, and the slider answers the next press.Problem and solution fit
architecture:react-component-runtimeINV5/INV7 keep document-level subscriptions scoped to the interaction that needs them.Expected behavior and authority
architecture:react-component-runtimeINV5/INV7 (current): document-level listeners are scoped to the interaction that needs them.component:SliderFR5 (current): an interaction ends when its drag is released; unchanged.Smallest restoration
Slider.tsx: the listener is added inhandlePointerDownand removed inendDrag(and on unmount); the lifetime Effect is gone. No API, prop, default, DOM or visual change.Evidence
main.horizontal-labels, which replaces the control node (the previoushorizontalkept it), and still passes: the drag ends and the next press works.Scope
Testing
pnpm vitest run packages/core/src/Slider: 100 passed.tsc --noEmitfor core; strict eslint; prettier.