-
Notifications
You must be signed in to change notification settings - Fork 160
Use Chrome's Passive Event Listeners #278
Comments
We certainly can't force that, because the events can be cancelled by the user. We could potentially add support for |
Obviously that's just for client code designed specifically for PEP. On browsers with native PE implementations they couldn't do that (or rather cancelling pointer events doesn't stop scrolling like cancelling touch events does). Is it a goal of PEP to match the native PE implementation behavior as closely as practical? |
Yes. Are you saying we shouldn't pass |
The standard behavior for PE is that calling preventDefault on a pointer event suppresses the generation of compatibility (mouse/touch) events, but doesn't affect scrolling and so should not be passed down to underlying touch events. I think that design dates back to before Chrome supported touch-action, and was intentional deviation from the PE spec to permit Polymer to do some things it wanted to do IIRC. If you're running in a browser that supports touch-action (beyond the limited support Safari has), then I think there should be no reason for you (or clients of PEP) to call preventDefault on a touchstart or touchmove event (since event-time control over scrolling is not possible with pointer events by spec). I recall chatting with @azakus about this at one point, but I think it's tricky to come up with something that works well in both browsers with touch-action and those where you need to use the touch-action-attribute hack. You'd need some different code paths for the two. I don't recall the details though, maybe it's not so bad? Even on a browser without touch-action support, it's wrong to flow calls on It's possible that |
In case it helps, our PE impl in blink at the moment is very much like a PE polyfill (implemented in terms of the touch and mouse events chromium sends to blink). The specific code for the behavior we're talking about is here. |
Closing due to discovery in #309. |
Can passive event listeners be used for the added touch listeners?
See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
The text was updated successfully, but these errors were encountered: