-
-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When dragging the ScrollArea thumb quickly, pointerup sometimes fails to fire cleanly, leaving the page in a broken state:
- Text becomes unselectable —
document.body.style.webkitUserSelectstays"none" - Scrollbar sticks to mouse — pointer capture is never released, so the thumb follows the cursor without clicking
Reproduction
- Render a ScrollArea with enough content to scroll
- Grab the scrollbar thumb and drag it very quickly
- Release the mouse button
- Try to select text anywhere on the page — cursor won't change and text is unselectable
- Move mouse into scrollbar region — thumb teleports to mouse and sticks
Root Cause
In scroll-area.svelte.ts lines 770-795:
onpointerdown(e: BitsPointerEvent) {
target.setPointerCapture(e.pointerId);
this.root.domContext.getDocument().body.style.webkitUserSelect = "none";
// ...
}
onpointerup(e: BitsPointerEvent) {
target.releasePointerCapture(e.pointerId);
this.root.domContext.getDocument().body.style.webkitUserSelect = this.prevWebkitUserSelect;
// ...
}If pointerup is missed (fast drag, system interrupt, etc.), there's no fallback to restore state.
Suggested Fix
- Add a timeout fallback to reset state if no
pointerupwithin ~100ms of lastpointermove - Or use the existing
TextSelectionLayerutility pattern for scoped user-select management - Or add a
pointercancelhandler as a safety net
Environment
- bits-ui: latest
- Browser: Chrome/Safari (both affected)
- OS: macOS
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working