Closed Bug 1178763 Opened 4 years ago Closed 3 months ago
Event .page X/page Y should be undefined
47 bytes, text/x-phabricator-request
|Details | Review|
Currently the pageX and pageY properties on TouchEvent (*not* the touch objects, but the top-level event itself) seem to return the scroll position. According to the discussion on input-dev  these properties should be undefined.  https://groups.google.com/a/chromium.org/d/msg/input-dev/4p1XZy_17aw/qi-LQuOtvpcJ
4 years ago
In FireFox: UIEvent.prototype.hasOwnProperty('pageX') true MouseEvent.prototype.hasOwnProperty('pageX') false Chromium is going to try to invert them; see: https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/pageX/blink-dev/pcMwyHRhbCU/FiVwBbImrS0J
It would be a tad risky change to move pageX/Y from UIEvent to MouseEvent, given that the properties have been in UIEvent for 10+ years.
We can wait for Blink to do it and see if they run into compat problems. If they don't then we should be ok to make the change as well. It would be good to standardize on something consistent, and our current behaviour is clearly just wrong.
(our current behaviour with TouchEvent, I mean)
This landed in Blink.
Is there any update on this issue?
Hello, Would you please clarify the status of this issue cause, as I can see, all other browsers fixed this issues years ago? Hope to hear from you soon.
Are you running into specific issues because of this? As far as I call tell you should be able to easily work around the current behaviour if it's causing problems - please let us know if that's not the case.
We check pageX/pageY to determine if the page is opened on the touch-enabled device\monitor because we have a different implementation for drag, drop, click (tap) events for touch and non-touch devices\monitors. What workaround do you mean?
As I understand it, the pageX/pageY properties shouldn't even exist on TouchEvent. So if you're reading those properties and getting bad values, you should just not read those properties and use something else. You'll have to do that anyway once this bug is fixed so you might as well start doing that now.
kats@ is correct. Chromium only exposes pageX/pageY on MouseEvent (and consequently PointerEvent) it does not expose it on UIEvent or TouchEvent.
The problem is that pageX/pageY in all browsers are undefined. But in the firefox, pageX/pageY properties contain values. So it is not possible to understand what event raise - touch or mouse.
Why not use event.type.startsWith("touch") or check the prototype?
5 months ago
4 months ago
Webcompat Priority: --- → ?
4 months ago
Whiteboard: [webcompat] → [webcompat][needs-wpt-?]
Webcompat Priority: ? → P3
Webcompat Priority: P3 → P2
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/9005dd228db5 move UIEvent.pageX/pageY to MouseEvent, r=masayuki
You need to log in before you can comment on or make changes to this bug.