pawelgrzybek / siema

Siema - Lightweight and simple carousel in pure JavaScript
https://pawelgrzybek.github.io/siema/
Other
3.48k stars 411 forks source link

Magic Mouse click event on a link almost always has defaultPrevented #202

Open kasparsz opened 6 years ago

kasparsz commented 6 years ago

Issue is only with Magic Mouse, couldn't repeat with touch pads or touch devices.

Issue: When carousel items have links and user clicks on it without dragging, with regular mouse "click" event doesn't have "defaultPrevented" because mousemove event wasn't triggered so it's not considered a "drag". With Magic Mouse "mousemove" events are triggered after "mousedown" even if mouse position (event.pageX) didn't changed, this breaks drag detection.

From what I have seen it's not always the case, if user didn't moved mouse between previous click and last click then "mousemove" events are not triggered, but that's irrelevant in this case.

Fiddle https://jsfiddle.net/kaszu/vyLgqzwd/ , problem can be repeated only with Magic Mouse.

Solution would be to check in "mousemoveHandler" if mouse has actually moved

if (this.pointerDown && e.pageX != this.drag.startX) {
wiseoldman commented 5 years ago

Just wanted to add that the click counter in your example is also incremented when I'm using my touchpad on my MacBook Pro 15" TouchBar (MLH32LL/A)

JoshuaCrewe commented 4 years ago

I think this is what I have been getting.

If I remove :

            if (e.target.nodeName === 'A') {
                this.drag.preventClick = true;
            }

Then I can click on the link. This is in the code to prevent navigating to the link if the user drags the slideshow over a link.