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

[cssom-view] Calling scrollBy() multiple times resets the current scroll operation #6897

Open
i124q2n8 opened this issue Dec 16, 2021 · 0 comments

Comments

@i124q2n8
Copy link

If scrollBy is called while a previous call to scrollBy is still "running" the current scrolling operation is canceled and a new one is started at the current position. In some cases, this leads to unintuitive behavior and a bad user experience.

In the following example you can click the "Scroll up" and "Scroll down" buttons to scroll up/down by 300px. Each of the colored rectangles are 300px high. If you do a double click on the "Scroll down" button the content is not scrolled by 600px, but some value between 300 and 600.
https://jsfiddle.net/u21e83rq/1/

I don't know whether this can be fixed, because the observed behavior is implied by the spec: https://drafts.csswg.org/cssom-view/#dom-element-scrollby

Add the value of scrollLeft to the left dictionary member.
Add the value of scrollTop to the top dictionary member.

It would be nice if the behavior of scrollBy would be similar to using the "Page up"/"Page down" keys or clicking in the "track-piece" of the scrollbar. (Doing so will not cancel any previous scroll operations but extend the scroll-animation to the new position)

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

No branches or pull requests

2 participants