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

scrollTop and scrollLeft should be clearer about their sign #29

Closed
dbaron opened this issue Aug 30, 2016 · 1 comment
Closed

scrollTop and scrollLeft should be clearer about their sign #29

dbaron opened this issue Aug 30, 2016 · 1 comment

Comments

@dbaron
Copy link
Contributor

dbaron commented Aug 30, 2016

The definition of scrollTop and scrollLeft could be interpreted as requiring a negative sign in the normal case, although probably not, given that it says "distance" rather than "location" or "offset", since it's described as from the visual viewport to the layout viewport (rather than the other way around).

However, I'm not 100% sure that we can promise that it always should be a nonnegative number, e.g., with touch overscrolling.

This makes me think that it should be described as an offset or location, but with the "from" and the "to" swapped from the way they currently are.

Noticed while reviewing the spec for w3ctag/design-reviews#128 .

@ymalik
Copy link
Collaborator

ymalik commented Aug 30, 2016

In Chrome's viewport architecture, the visual viewport is always contained within the layout viewport, which is why scrollTop and scrollLeft will always be non-negative (I believe even with touch overscrolling). Though, this may not be the case for other vendors, so I agree that we should avoid using "distance" and use position or offset with the "from" and "to" swapped. Thanks for bringing this up!

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

No branches or pull requests

2 participants