Chrome tapping on touchpad fires mouseleave

joox

Recently, my website began to work quite weirdly in Chrome. I found that in Chrome, tapping a touchpad now (since a recent update?) fires two events - click and mouseleave.

<div id="tap">HOVER, TAP or CLICK</div>
<script>
tap.addEventListener("mouseleave",function(){alert("mouseleave");});
tap.addEventListener("click",function(){alert("click");});
</script>

Here is the JSFiddle:

So far, it seems like this issue only applies to Google Chrome. In Firefox and Yandex (Chromium based) fake mouseleave doesn't fire. Clicking by button (either mouse or touchpad button) also works fine - no mouseleave.

How can i prevent this mouseleave on tap? Or, maybe, there's a way to tell a tap-mouseleave from the real mouseleave?

comshak

I've noticed that when the incorrect tapping behavior happens in Chrome, we can inspect the mouseleave event object to determine if it's the buggy behavior or not:

mouseleave = function (e) {
  if (e.screenX === 0 && e.screenY === 0) {
    // BUG in Chrome
    return;
  }
  // Correct behavior...
}

Alternatively, we can check e.toElement and/or e.relatedTarget, since I've noticed those being null when the buggy behavior happens:

mouseleave = function (e) {
  if (!e.relatedTarget || !e.toElement) {
    // BUG in Chrome
    return;
  }
  // Correct behavior...
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Tapping Laptop Touchpad problem

touchpad 'tapping' doesn't work in login screen

Enabling touchpad tapping after installing dwm on Arch Linux

How do I prevent pointer from jumping when tapping touchpad?

How to enable touchpad scrolling and tapping in Debian Wheezy KDE?

jquery mousenter and mouseleave with chrome

Chrome not scrolling with touchpad

jQuery mouseleave fires an event if input has preselected values

jQuery mouseleave fires when first item from autocomplete is selected

Disable Predictive Scrolling - Mousewheel (OnScroll) Event fires too often (Touchpad)

How can I setup my touchpad multi-finger tapping functionality?

mouseleave event for document, with consideration for Chrome bug

Chrome extension message listener fires twice

mobile chrome fires resize event on scroll

Click event on <div> not firing on Firefox but fires on Chrome

Import() in React - fires error in the Chrome/Firefox extensions

ng-mouseover and ng-mouseleave events not working on chrome

Chrome/Chromium causes laggy touchpad on lubuntu 14.04 at MacBook

Touchpad lag while using Chrome in Ubuntu 16.04 and 16.10

Prevent "Complete action using..." dialog in android's chrome, when tapping a link?

CAShapeLayer Tapping

Google Chrome on mobile fires additional unwanted MouseEvent on file input

Chrome extension background message listener fires up twice

How to use touchpad gestures to scroll back and forth in history on non-Mac OSX devices in Google Chrome?

Bootstrap modal stop scrolling on Chrome 41 with mouse scroll/touchpad (but works with up/down keys)

How to prevent touchpad scrolling from carrying over to different tabs on Windows/Chrome?

mouseleave on a parent

JQuery - mouseleave

Mouseleave delay