Damping effect gone after calling ev.stopPropagation()
See original GitHub issueChecks
- Not a duplicate.
Version
8.8.1
Description
Just same as title.
I was trying to stop touch event bubbling, then I found If I use ev.stopPropagation()
, it will cause the scrollbar damping effect disappear.
Steps to Reproduce
- create a normal smooth-scrollbar-inited container
- bind on
touchend
event on any element in the normal smooth-scrollbar-inited container. - in the event handler, call
ev.stopPropagation()
Online Demo
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:5
Top Results From Across the Web
Event.stopPropagation() - Web APIs | MDN
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Read more >Pros and Cons of using e.stopPropagation() to prevent event ...
There is no noticeable performance degradation because you allow an event to bubble up because these are user level events and they just...
Read more >The Dangers of Stopping Event Propagation - CSS-Tricks
We know there's bad advice on the Internet promoting the unnecessary use of stopPropagation , but that isn't the only reason people do...
Read more >How to correctly use preventDefault(), stopPropagation(), or ...
Prevents the event from bubbling up the DOM, but does not stop the browsers default behaviour. For an in-depth explanation of event bubbling,...
Read more >Event Bubbling and Event Catching in JavaScript and React
⚠️ If we use event.stopPropagation() , it would stop one event handler from triggering – but then you would never be able to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
you need to be cautious about using
stopPropagation
just found a solution from https://github.com/idiotWu/smooth-scrollbar/issues/444
https://stackblitz.com/edit/vitejs-vite-9e2btw?file=main.js
@sadeghbarati
Sorry, I found I made a mistake, it’s
touchend
event, notclick
.If you need to check it with this stackblitz demo below, you will have to switch to mobile mode (with touch) ( chrome developer tool).
You will notice that the damping effect just disappear after the
touchend
event trigger by “touchend” that “stopPropagation” button.https://stackblitz.com/edit/vitejs-vite-hglpla?file=main.js