Consider aligning with Chrome's behavior for restoring the scroll position on back button presses.
Categories
(Core :: DOM: Navigation, enhancement, P3)
Tracking
()
Webcompat Priority | P3 |
People
(Reporter: twisniewski, Unassigned)
References
Details
In this crbug, Chrome effectively chose to not let sites use scrollTo(0,0)
and the like to bounce the user back to the top of the page. I suspect this is something worth aligning with, as even ABCNews is bouncing the user back to the top of the page with this trick when they press the back button, making the user lose their scroll position.
Updated•5 years ago
|
Comment 1•5 years ago
|
||
I'm a bit lost here. The crbug says
'we decided not to support "Prevent browser restoration if js scroll called before
browser restoration happens".'
Majid, perhaps you know what blink is actually doing these days? And if it is not following the spec, has a spec bug been filed?
Updated•5 years ago
|
Comment 2•4 years ago
|
||
Last I recall we didn't follow up with that idea. So Chrome scroll restoration would not necessarily honor call to scrollTo(0,0) and can override it.
One change that we have made here is that we use a more sophisticated way to remember the scroll state itself. Rather that the scroll position if possible we remember and restore an "anchoring element" [1]. But I think the spec is not specific on what is the exact scroll state to be restored. I am not sure what ABC site is doing so this may or may not be relevant.
Comment 3•4 years ago
|
||
Anne, should we file a spec bug to get consistent behavior and clear expectations for the scroll state to be remembered and restored?
Comment 4•4 years ago
|
||
Yeah, that would help, especially with rather concrete scenarios (or pointers to tests). I did a quick search and there's currently four issues around store restoration, but none seem to cover the case comment 0 is talking about:
- https://github.com/whatwg/html/issues/404
- https://github.com/whatwg/html/issues/1042
- https://github.com/whatwg/html/issues/2647
- https://github.com/whatwg/html/issues/5103
Thomas or Majid, would either of you be willing to file an issue? Thanks!
Reporter | ||
Comment 5•4 years ago
|
||
Done, I just filed https://github.com/whatwg/html/issues/5151 .
Updated•4 years ago
|
Updated•4 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•1 year ago
|
Description
•