-
Notifications
You must be signed in to change notification settings - Fork 159
Set button property to -1 if no mouse button is depressed. #267
Conversation
I may have this the wrong way around - I understand the spec the following:
In https://www.w3.org/TR/DOM-Level-3-Events/#attributes-2:
I feel like pointerevents mean to give the On IE 11 Win7:
On FF44 - OS X (with flag):
Would be great if someone could confirm these inconsistencies. I used this fiddle for testing: http://jsbin.com/buxabi/31/edit?js,output For now, we could try to make sure that the events: |
Thats exactly the ambiguity I also encountered. I have the same outputs with you in FF44 / Win10 (like your FF) and IE/Edge / Win10 (like your IE). I feel This PR should produce the output you also suggested: |
it might be worth bringing up the ambiguity over here https://github.com/w3c/pointerevents (admittedly, i've not delves into the |
@Steditor: Ah yes, great! Sorry, I first thought you update the Thanks for testing the other browsers! You can activate the existing functional test for this: https://github.com/jquery/PEP/blob/b4be88d/tests/intern.js#L30-L31 . After that: lgtm @patrickhlauke: Good point. I have been wondering why there are no web-plattform-tests to enforce a consistent behaviour for this, although chorded button interactions have their own paragraph in the spec. |
12f8225
to
80c400f
Compare
I have now activated the functional test. |
Over at w3c/pointerevents#33 the In short, only a In @Steditor do you possibly have time to update your PR accordingly? |
Thank you for the clarification! |
80c400f
to
4788e83
Compare
Ok, now we have I guess we need a WPT-test for this before the PR can be merged? |
4788e83
to
f15208d
Compare
Can you point to the code you're referring to? I don't see any encoded paths in the code. |
We should certainly make sure WPT has assertions to cover this, but I'm fine with merging before that whole roundtrip can happen. |
In |
Ah, I was searching the code for the actual encoded characters. @jdalton is the one who did that. It seems like it should be safe without that. |
@robfitz273k Could you elaborate on the problem you are experiencing with Firefox 44 on desktop? What mouse buttons do you press, in which order and what is expected/actual? This fiddle uses the current state of this PR: http://jsbin.com/buxabi/38/edit?html,js,output. |
Current behaviour with: http://jsbin.com/buxabi/38/edit?html,js,output.
Expected:
With the current proposed fix we can't tell the state change between the second and third action, was it a button press or button release. Changing this line |
f15208d
to
20f6b4d
Compare
@robfitz273k I have now decided to simply clear the bit - if it hadn't been set, nothing changes anyway. |
@Steditor yes that's working as expected now. |
@robfitz273k Thank you for the detailed description! Tried it on Ubuntu 14.04 with FF 44 and have the same issue with PEP-4.1. @Steditor Good idea to swap the bit. Works like a charm. |
Testing the touch behaviour of http://jsbin.com/buxabi/38/edit?html,js,output with Firefox 44 on my Android phone. Current:
Expected:
I can get this result by adding the line |
I'd suggest to fix this in a separate PR as this PR only dealt with MouseEvents as source so far. |
Fixes #173 by setting the
button
property to-1
ifbuttons
is0
, indicating that no button is depressed.I couldn't find anything in the recommendation on the expected value of
button
in events other thanpointerup
andpointerdown
. In theory, we could add more events, in which thebutton
property contains correct data: Whenever only one button is depressed, we could set thebutton
value to the current depressed button by reverse-mappingbuttons
. But as this would still leave us with loads of situations, in which one cannot use thebutton
property, I decided against patching it for all possible cases.Any thoughts on that?
In addition, this PR adds to #243 as PEP now not only detects an incorrect buttons state, but also fixes it.