Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully polyfill touch-action behaviour for scrolling #311

Open
bethge opened this issue Sep 11, 2016 · 0 comments
Open

Fully polyfill touch-action behaviour for scrolling #311

bethge opened this issue Sep 11, 2016 · 0 comments

Comments

@bethge
Copy link
Member

@bethge bethge commented Sep 11, 2016

While looking into (#309) using passive event listeners and the native touch-action property, we came across some inconsistencies in PEPs way of calculating the touch-action property.

The spec says:

When a user touches an element, the effect of that touch is determined by the value of the touch-action property and the default touch behaviors on the element and its ancestors. To determine the effect of a touch, find the nearest ancestor (starting from the element itself) that has a default touch behavior. Then examine the touch-action property of each element between the hit tested element and the element with the default touch behavior (including both the hit tested element and the element with the default touch behavior). If the touch-action property of any of those elements disallows the default touch behavior, do nothing. Otherwise allow the element to start considering the touch for the purposes of executing a default touch behavior.

Up to now, we have not properly calculated the intersection of the touch-action properties of all ancestors of an element up to the element with the default touch behaviour.

To us, the default scroll behaviour is the most relevant default touch behaviour and generally the one with the most impact.

For scrolling, the element "creating" a scrollable area is the one with the default scroll behaviour. E.g. an element with the CSS property overflow: scroll will be the the element with default scroll behaviour, its children will not be.

An element has a default scroll behaviour if (not guaranteed to be all cases):

  • It has the CSS property overflow: scroll, overflow-x: scroll or overflow-y: scroll
  • It has the CSS property overflow: auto, overflow-x: auto or overflow-y: auto and the content is larger than the element.

An example of the different behaviours. Try it in Chrome with the mobile emulator.

Chrome's implementation for computing the touch-action value.

This mostly just summarises this weeks PEP meeting. Thanks to @RByers for the insights!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.