glide icon indicating copy to clipboard operation
glide copied to clipboard

Select click trigger a move of slider v3.4.1

Open sinfulcapacity opened this issue 5 years ago • 7 comments

If you have a selection inside the slide and try to select a value slide's trigger move event for the carousel.

Code example https://codepen.io/sinfulcapacity/pen/GRpraPr

Have also discovered if you mount glideJs and it is empty then the browser crashes.

sinfulcapacity avatar Apr 23 '20 19:04 sinfulcapacity

I've noticed this too. If you long press on the select field the issue doesn't occur for some reason though. Looking at the fired events it looks like they are the same for those two scenarios though.

On mobile it doesn't happen either (or with Firefox's touch simulation).

sthyregod avatar Jul 06 '21 08:07 sthyregod

This also happens when I try to right-click a slide to inspect it in Firefox.

It also happens on Chrome if I right click one slide and then click on another slide to dismiss the context menu, it transitions to that slide.

It appears Glide assumes mouse travel as drag/move indicator and right-clicking and having a context menu open and then closing it triggers a transition to the next/previous slide, depending on where the mouse cursor is when the context menu disappears.

mmietz avatar Mar 22 '22 12:03 mmietz

Any updates? I am facing the same issue

elvonkh avatar Apr 04 '22 07:04 elvonkh

Facing the same problem

vladikko avatar Jul 05 '22 11:07 vladikko

the working fix I just wrote for this was to set an onmousedown on each select w/ code like:

window.myNamespace ??= {};
window.myNamespace.blockGlide = true;
setTimeout( () => { 
  window.myNamespace.blockGlide = false; //this only needs to be set for like 20ms, but i wanted headroom
}, 200);

then in my glide code:

 myGlideInstance.on('run.before', ( move )=>{
    if(window?.myNamespace?.blockGlide){
      move.direction = "="; // direction here at runtime was ">" and steps is 0 in my code FWIW 
    } else {
      //the code that was previously running on run.before
    }
 })
 

oneeyedziggy avatar Apr 25 '24 23:04 oneeyedziggy