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

Window scrolling #7

Open
Rainbowlemon opened this issue Nov 15, 2017 · 2 comments
Open

Window scrolling #7

Rainbowlemon opened this issue Nov 15, 2017 · 2 comments

Comments

@Rainbowlemon
Copy link

On a traditional pageload, the page will be scrolled to the top. This is especially important when navigating from a long page to another page - being in the middle of the new page is disorienting. A short-term solution would be to use the following after a DOM write:

document.body.scrollTop = document.documentElement.scrollTop = 0;

@Rainbowlemon
Copy link
Author

Have added this for now, so will close. In an ideal scenario, though, this would only happen when the user is navigating forwards.

@ostrolucky
Copy link
Contributor

I think this is valid and I don't see it solved in this library. Exact behaviour should be discussed though. There are lot of exceptions to this, like:

  • going back
  • opening/closing modals
  • replacing with content which differs in minor thing only

Ajaxcom solves some unintuitive default browser behaviour regarding this is, for example when you delete an entity from a long list of entities, browser shouldn't jump to the top.

Maybe simple solution would be to jump to the top only when hash has been specified in an url

@ostrolucky ostrolucky reopened this Nov 16, 2017
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