-
Notifications
You must be signed in to change notification settings - Fork 159
PEP skipping second pointerdown event after mouseover event on Chrome #308
Comments
That very much sounds like the Could you by chance create a simplified demo of the behaviour? I tried to whip something up but the |
I'll have a look at creating a standalone demo tomorrow. Is there a convenient external link point for the development version of the library? The only externally linkable version built from master I have right now has my hacky workaround in place, so will not exhibit the problem. I also just noticed this issue: And while that report seemed to be touch specific, which isn't relevant to my case, the item I am revealing after the mouse up, that is triggering the mouseover with buttons=1 does involve CSS transform, so I wonder if Chrome generally has some strange timing interactions between rendering with transforms and event processing. I'm also not sure if it is relevant, but I have separate 'over' listeners at the document level to handle page wide tooltips, so that might also change how things get processed by Chrome. |
ping @RByers |
I'd agree that it's a Chrome bug to ever dispatch a |
Sorry, I've done some more testing, and there was an inaccuracy in my original report. The mouseover is not getting fired after the mouseup, but rather before the mousedown. The trigger conditions seem a bit complicated, because it doesn't happen every time, but I can fairly reliably reproduce the problem without PEP here by clicking on the open/close on the goey menu: Initially I get output like this (first number is e.buttons, second is a counter of number of events) as I toggle the 'goey' menu open and closed: However if I reposition the mouse so that it is directly over the drawn elements of the hamburger/close button after a few initial clicks, the behaviour changes to this: It keeps cycle through this sequence even though I am not moving the mouse. This appears to be the sequence I am seeing in PEP where the mouse down is ignored due to the mouseover The codepen code isn't exactly the same as my code, as it is triggering the transformations with CSS only, whereas my code is using mouse/pointer events to trigger the transformations, but the principal of mouseover preventing mousedown firing a down event due to the buttons!=0 case seems to be the same. I also don't use the 'goey' svg transformation, and only animate the springing out of the menu items, so I don't think that is relevant either. Sorry this example isn't as simple as it could be, I tried a simpler example with scale transforms, and had trouble reproducing the problem (it is still not 100% reliable, as it can take a few attempts to get the mouseover:1 firing reliably). I'm running this on Mac OS X 10.9.5, just in case the older Mac OS version is relevant. let me know if you need more clarification. |
PEP has now entered emeritus status at the OpenJS Foundation. This repository is now archived. |
There was a previous bug filed against this bheaviour here:
#279
But it was closed with a potential fix. Unfortunately I don't think the fix handles all the cases under which this can occur.
Specifically, I'm still seeing the problem with code checked out from master, and it looks like
the issue in my case is related to mouseover inserting entries in the pointer map on Chrome latest ( 52.0.2743.116 Mac OS X - May be Mac specific).
From the mousedown code:
So what happens in my case is that after receiving a pointerdown/pointerup combination on a DOM element, I add a new UI element right under the mouse pointer (basically at the poinerup location - the pointerdown/pointerup sequence is triggering a menu display). This then triggers a 'mouseover' event, which PEP's mouse over handler inserts into the pointermap. Normally this would be ok, because of the p.buttons === 0 check in the mousedown code that allows mousedown's to trigger pointerdown with an existing pointermap entry with no buttons held. However in this case, Chrome is generating a mouseover event with e.buttons = 1.
This is despite the fact that the last event processed was mouseup so buttons should now be 0. I suspect Chrome is generating the mouseover event inside the mouseup handler which displays the new element, and so still thinks buttons =1 from the state previous to mouseup, even though the mouseover event is processed (at least in PEP) AFTER the mouseup event.
I don' really understand the event semantics enough to know if this is a bug in PEP or Chrome. I'm guessing it is a Chrome bug, but given the polyfill's job is to provide the correct event firing despite browser differences, I figured it is probably worth filing as a bug here.
For now, I'm working around this in my code by hacking the PEP mousedown/mouseover to explicitly mark the pointermap entry as being derived from a mouseover, and then allowing mouseover pointermap entries to trigger pointerdown , even if buttons > 0. I would imagine there are side effects to this for some cases that matter to others, so it doesn't provide a long term solution, but it works in my use case.
Note that this doesn't happen on at least Firefox, which further suggests that the buttons = 1 for mouseover after mouseup behaviour of Chrome in this case is probably a Chrome bug.
The text was updated successfully, but these errors were encountered: