everlutionsk / ajaxcom-js

1 stars 5 forks source link

Window scrolling #7

Open Rainbowlemon opened 6 years ago

Rainbowlemon commented 6 years ago

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 commented 6 years ago

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

ostrolucky commented 6 years ago

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:

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