Replies: 6 comments 3 replies
-
By the way, I think you can use splide/src/js/components/Drag/Drag.ts Lines 185 to 192 in 815030f |
Beta Was this translation helpful? Give feedback.
-
Hi idiotWu, I think yes. I also wondered if it was necessary, but I decided to add it because:
Thanks for the info about |
Beta Was this translation helpful? Give feedback.
-
Thanks for your clarification! AFAIK,
It doesn't seem necessary to eliminate tap/click behaviors in your case, so I think calling FYI: as a JavaScript-based scrolling library, we only call |
Beta Was this translation helpful? Give feedback.
-
...and from the same MDN source:
Ref: https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#handling_clicks |
Beta Was this translation helpful? Give feedback.
-
Then why do they call |
Beta Was this translation helpful? Give feedback.
-
This google guidance also calls I guess the purpose is... "just in case", since the user agent can freely determine whether to implement the default action or not. Unfortunately it can break your library, but I have to keep my |
Beta Was this translation helpful? Give feedback.
-
Hi there! I am the author of smooth scrollbar, and I just received this bug report from a user of splide: idiotWu/smooth-scrollbar#435
This is a sandbox that reproduces the issue: https://codesandbox.io/s/splide-forked-dzxcn. You can move the slider horizontally first, and then trigger a scroll in the below or above area to see the weird behavior.
Kapture.2022-01-22.at.08.07.08.mp4
After some debugging, I found that you are calling
event.preventDefault()
on touchend events and therefore break the smooth scrollbar. As per our current design, we calculate the touch moving speed by the following steps:touchstart
: create a list of trackers for the pointers inevent.touches
and track them usingtouch.identifier
touchmove
: calculate and update the moving velocity of each corresponding trackertouchend
: release the corresponding tracker and return the final velocityHowever, as we ignore the default-prevented events, calling
event.preventDefault()
on touchend will prevent the tracker from being released and resulting in the bug. So my question is: is it necessary to callevent.preventDefault()
on touchend events?P.S. it seems you didn't call
touchEndEvent.preventDefault()
in splide@2Beta Was this translation helpful? Give feedback.
All reactions