-
Notifications
You must be signed in to change notification settings - Fork 24
Spec should be explicit on whether the order of elements in TouchLists is relevant #13
Comments
My gut feeling is that no, the spec should clarify that the order/index may change and that authors should rely only on the id. I've not had a chance to test it, but: if i put 3 fingers on the screen in sequence, and then remove the second one, is the expectation from devs that you'd still see a touch point on 0 and 2 in the touchlist? what would index 1 contain, then? null? |
I also don't think we should specify an order for existing touches. On Fri, May 8, 2015 at 1:19 PM, Patrick H. Lauke [email protected]
|
I don't think we'd ever want to leave gaps no. We should test to see if On Fri, May 8, 2015 at 1:22 PM, Scott González [email protected]
|
On 11/05/2015 20:07, Rick Byers wrote:
Ah, so the site was relying on the order/index remaining the same If I were hardline (and well, I don't have a browser/compat issues to |
It looks like hammer.js has this issue in their rotation gesture recognizer (rotation will flip 180 degrees if the two touch points swap position in the touches list). Even if they fix this, we know tons of sites use hammer.js (though I'm not sure how common rotation gesture recognition is). |
Just doing a gentle ping here...still think it's worth a general note about the order of the individual touches in the touches/targetTouches/changedTouches arrays/collections/whatever-they're-actually-called being potentially arbitrary, and that scripts should not rely on the order but on the |
as well as the unique identifier for each Touch - demonstrates that order of individual Touch objects in a TouchList is not always guaranteed, particularly when a Touch is added/removed (but identifier remains unique, so only that should be relied upon). Refs w3c/touch-events#13
Did some very rough and ready testing with this http://patrickhlauke.github.io/touch/tracker/multi-touch-tracker-index.html (which only uses touch events and visually shows each touch in While during a touch interaction (once all touches have been placed on the screen) the order of touches in the TouchList object doesn't seem to change (the index remains consistent, at least in the tested browsers) in most cases, there are some tricky variations when touches are added/removed:
Personally, I feel it would be better to write a generic note explaining that the order in which Touch objects can be found in the various TouchList objects can change arbitrarily (particularly in situations when a touch is added or removed), and that authors should not rely on it - instead, to explicitly track a touch in a multi-touch case, they should refer to the unique Thoughts? |
(just edited the previous comment, as further testing reveals there's some reason behind the strange behavior of Chrome and Firefox on Android - it's not that a new touch is added to index 0, but rather it seems that if a touch is removed and then a new touch is added, this new touch is given the index of the previously removed one...like it has some sort of "memory") |
having said that, if we see that there are scripts in the wild which rely on the (fairly rock solid, from my testing) Safari/iOS behavior (order always preserved during gesture, order preserved when a touch is removed, new touches always added at the end), then perhaps we could document that "generally" that's the behavior, but that authors should nonetheless not rely on it? or can we even mandate that browsers should/must do it this way (and file relevant bugs against those that don't)? |
Thanks for doing the research Patrick, that's excellent! Given that Safari and Edge seem consistent on a behavior that is generally useful to developers, I'd lean towards just specifying it that way (developers WILL depend on it, regardless of what the spec says) and fix Chrome to match. +NavidZ WDYT? |
For completeness of test results: just tried Vivaldi Browser 1.0 on Surface 3/Windows 10:
|
revisiting this, as it's been bugging me...before i go off an propose a PR, here's what i plan to add. due to the fact that it does indeed seem that there's some inconsistency in existing implementations, like in Firefox, i'd propose adding these as normative statements (but i'll work on some cleaner wording, this is just to get the concepts down):
in short, the only MUST is that there be no gaps in touchlists. the SHOULDs reflect most sane current behavior. non-normative note reinforces that authors should rely on thoughts? |
Those all sound reasonable, but I think the note that authors should rely on |
I believe the order of TouchList entries is supposed to be irrelevant. However some sites (eg. this one) make assumptions about a given touch ID remaining at the same index in the TouchList from event to event. There was a special case in blink where we weren't preserving order, and we're going to fix this.
In what cases is the ordering preserved in existing browsers? Should we just make that part of the spec so that sites can depend on it? It can certainly simplify some coding patterns.
The text was updated successfully, but these errors were encountered: