Open Bug 1593064 Opened 5 years ago Updated 1 year ago

Consider aligning with Chrome's behavior for restoring the scroll position on back button presses.

Categories

(Core :: DOM: Navigation, enhancement, P3)

enhancement

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.

Flags: needinfo?(bugs)
Flags: needinfo?(annevk)

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?

Flags: needinfo?(bugs) → needinfo?(majidvp)
Flags: needinfo?(annevk)

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.

[1] https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/loader/frame_loader.cc?type=cs&sq=package:chromium&g=0&l=1205

Flags: needinfo?(majidvp)

Anne, should we file a spec bug to get consistent behavior and clear expectations for the scroll state to be remembered and restored?

Flags: needinfo?(annevk)

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:

Thomas or Majid, would either of you be willing to file an issue? Thanks!

Flags: needinfo?(annevk)
Priority: -- → P3
Webcompat Priority: ? → revisit
Webcompat Priority: revisit → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.