ilyashubin/scrollbooster

link drag issue

Closed this issue · 5 comments

Hi, Ilya!

If there are links in draggable container, they will be fire click event while dragging.

Hello! Right now click event is not prevented by default. Maybe its a good idea to prevent any clicks by default, I'll think about it, thanks
Right now you can do this:

new ScrollBooster({
  ...
  onClick: (state, event) => {
    // prevent default link event
    const isLink = event.target.nodeName.toLowerCase() === 'link';
    if (isLink) {
      event.preventDefault();
    }
  }
});
jos- commented

It would be better to still allow normal clicks. See donmbelembe/vue-dragscroll#61 (comment) for a possible solution.

Good workaround, thank you! For now I implemented drag offset based solution instead of timer based, because I have access to those metrics
So preventDefault is called only when scrolled more than 5 pixels
15f8264

jos- commented

Nice, thanks for the fix.

This fix is in v2.2.2, closing