zefoy / ngx-perfect-scrollbar

Angular wrapper library for the Perfect Scrollbar
MIT License
522 stars 116 forks source link

Click events from scrollbar should not be propagated #233

Open viperphase1 opened 5 years ago

viperphase1 commented 5 years ago

I want to use the perfect scrollbar directive on a dropdown select list. The dropdown opens and closes whenever something inside is clicked. Since the directive adds elements inside the parent container and click events are allowed to bubble up to the parent I can't keep the dropdown open while scrolling. I consider this to be a bug/unwanted behavior.

sconix commented 5 years ago

You can always capture the events and stop the propagation. Would not make any sense to not propagate them as a default.

Zordaxy commented 4 years ago

Stopping propagation on the parent breaks perfect scrollbar.

It looks that if event does not reach the document - perfect scrollbar will not work.

For example if to stop propagation of mousemove in any parent - it breaks scrollbar movement: https://stackblitz.com/edit/ngx-perfect-scrollbar-5dv1df

sconix commented 4 years ago

Yes you can not stop the scroll events, but click event can be stopped.

jay3dec commented 4 years ago

@Zordaxy I added an event handler to the vertical scroll bar ('.ps__rail-y') and on clicking the scroll I stopped the click event as mentioned by @sconix . It seems to solve the issue. I have mentioned about it in my blog . Hope it helps. Thanks