Contact emails
lan...@chromium.org, tdre...@chromium.org, dtap...@chromium.org, rby...@chromium.org
Spec
https://w3c.github.io/touch-events/#cancelability
https://docs.google.com/document/d/1jXaK9JcqpZtiNMoXvmgJ6sZ6K04wCO1VKIqvJeFM8wI/
Summary
Passive Event Listeners is a way to improve scroll performance by unblocking scrolling on touch and wheel event listeners, so that scrolling happens immediately while the events are processed by javascript. alexclarke@ proposed that we should treat all the touchstart and first touchmove event listeners as passive while there’s an active fling animation on the touched layer.
After running this intervention as a field trial on 50% users on both Canary and Dev since M54, the 98th percentile of the first gesture scroll update latency on Android devices is reduced by 6.69%.
Link to chrome-input discussion
https://groups.google.com/a/google.com/d/msg/chrome-input/_tyas1nNmfk/lxevE5O3CAAJ
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes
Ongoing technical constraints
No
Demo link
This page tests that the touch event is cancelable if a fling is active on a different layer than the touched layer.
http://output.jsbin.com/fajekiw/quiet/
This page tests that the touch event’ cancelable attribute is set to false when there is an active fling on the touched layer.
https://output.jsbin.com/qegemu/quiet/
Compatibility risk
Safari sets touch events’ cancelable property to be false while there is an active fling on the touched layer, so calling ‘preventDefault’ does not have any effect on them. Our intervention matches its behavior.
Firefox and IE/Edge do not invoke any touch event listener at all when there is an active fling on the touched layer. We do not prefer this approach, because we want it behave consistent with our passive event listeners.
OWP launch tracking bug
https://bugs.chromium.org/p/chromium/issues/detail?id=646069
Entry on the feature dashboard
https://www.chromestatus.com/features/5707400183021568
Requesting approval to ship?
Yes
https://output.jsbin.com/zacota/quiet, shows that Safari sets the touchmove events' cancelable property to false, when there is an active flinging animation, but the touchstart events' cancelable is still true. If we are calling preventDefault on every other touchmoves, we can still see scrolling continuously happen during an active fling (https://jsbin.com/jegobo/quiet/).
Sorry, I should not say that our fling intervention behavior matches exactly with Safari.
We made several testing pages,https://output.jsbin.com/zacota/quiet, shows that Safari sets the touchmove events' cancelable property to false, when there is an active flinging animation, but the touchstart events' cancelable is still true. If we are calling preventDefault on every other touchmoves, we can still see scrolling continuously happen during an active fling (https://jsbin.com/jegobo/quiet/).
On Mon, Dec 5, 2016 at 9:00 AM Lan Wei <lan...@google.com> wrote:
Contact emails
lan...@chromium.org, tdre...@chromium.org, dtap...@chromium.org, rbyers@chromium.org
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
Compatibility risk
We observe the below behaviors when there is an active fling,
‘cancelable’ attribute of touch events only when there is an active fling on the touched layer | Can ‘preventDefault’ on touch events? | ||
Touch Start | Touch Move | All touch events | |
Chrome | false | false | no |
Safari | true | false | no |
Edge | true | true | no |
Firefox | true | true | no |
I missed some cases in the previous email. Below chart summarizes all the cases.
When we touch on a layer on which there is an active fling animation, the touch events have four pssible outcomes,
Cancelable: the 'cancelable' attribute is true, and we can call ‘preventDefault’ on it.
Uncancelable: the 'cancelable' attribute is false, and we cannot call ‘preventDefault’ on it.
Not Dispatched: the events are not dispatched, so the event listeners will not be invoked.
Uncancelable but marked cancelable: the 'cancelable' attribute is true, but we cannot call ‘preventDefault’ on it, so it should be treated as 'uncancelable'.
Browser | Touch Start | Touch Move |
Chrome | Uncancelable | Uncancelable |
Safari | Cancelable | Uncancelable |
Edge | Uncancelable but marked cancelable | Uncancelable but marked cancelable |
Firefox | Not Dispatched | Not Dispatched |
Contact emails
lan...@chromium.org, tdre...@chromium.org, dtap...@chromium.org, rbyers@chromium.org