-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #6101: Slider: event.value in onSlideEnd returns null on touch devices #6104
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
@kl-nevermore can you try this more concise version? const trackTouch = (event) => {
const changedTouch = event.changedTouches?.find(touch => touch.identifier === touchId.current);
if (changedTouch) {
return {
pageX: changedTouch.pageX,
pageY: changedTouch.pageY
};
}
return {
pageX: event.pageX,
pageY: event.pageY
};
}; |
components/lib/slider/Slider.js
Outdated
@@ -156,11 +163,32 @@ export const Slider = React.memo( | |||
barHeight.current = elementRef.current.offsetHeight; | |||
}; | |||
|
|||
const trackFinger = (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const trackFinger = (event) => { | |
const trackTouch= (event) => { |
|
OK then just rename to |
maybe? const trackTouch = (_event) => {
const event = Array.from(_event.changedTouches ?? []).find((t) => t.identifier === touchId.current) || _event;
return {
pageX: event.pageX,
pageY: event.pageY
};
}; |
Oooh I like it! |
or reverse it called the param |
Updated |
superb |
Fix #6101
touchend
does not containtouches
changedTouches
with reference toMUI
safari