radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.44k stars 776 forks source link

Slider onValueChange is not called repeatedly when dragging on Android #3010

Open VersorVerbi opened 2 months ago

VersorVerbi commented 2 months ago

Bug report

Current Behavior

When a user touch-and-drags on a slider (with or without a <Thumb /> component), onValueChange is called once, maybe twice, and then stops, even if the user continues dragging.

Expected behavior

onValueChange would continue to be called until the user stops dragging, and then we would get onValueCommit. (This is how it operates via mouse.)

Reproducible example

GitHub Pages (Code)

Suggested solution

I'm not sure offhand if Android is rejecting the events because there are too many of them, or if the touch events are not being interpreted correctly by the Radix code. My gut reaction is that it's one of those two.

Additional context

I cannot reproduce this on iOS 17.1.1 / iOS Safari 17, only on Android devices.

Your environment

Reproducible example is in React 18.3.3 & uses npm, original code where I discovered it is in React 18.2.0 & uses pnpm.

Software Name(s) Version
Radix Package(s) react-slider 1.2.0
React n/a 18+
Browser Chrome 126.0.6478.122
Assistive tech n/a
Node n/a 20.14.0
npm/yarn npm / pnpm 10.7.0 / 9.4.0
Operating System Android 14
LeoLTM commented 1 month ago

I got kind of the same issue while running radix-ui components in my Tauri application on my Raspberry Pi 4 + touch display. The sliders do not work at all when I try to interact with them using touch. Mouse dragging is no problem though.