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

Scrolling up on clear #54

Open
sigvei opened this issue Sep 2, 2015 · 1 comment
Open

Scrolling up on clear #54

sigvei opened this issue Sep 2, 2015 · 1 comment

Comments

@sigvei
Copy link
Contributor

sigvei commented Sep 2, 2015

In squiffy.ui.scrollToEnd, the scrolling is conditional on the content being lower than the current position. But when you switch to a new section with @clear, this works poorly, throwing the user to the page footer.

It seems to me the simplest fix would be to simply remove the if (scrollTo > maxScrollTop) and do scrolling no matter if we move up or down, but I might be missing some case where this leads to trouble.

@alexwarren
Copy link
Contributor

The if (scrollTo > maxScrollTop) just sets the maximum "scroll to" position as the end of the document, so it doesn't try to scroll beyond the end of the document. This is necessary for smooth scrolling animation, otherwise it will just suddenly stop once the scroll point reaches the maximum.

I haven't tested this yet but I expect the fix may be to set the scrollTop of the body and html elements to 0 when doing a clear.

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