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

scroll restoration mode handling doesn't specify which scroll position restoration it is about #349

Closed
smaug---- opened this issue Nov 18, 2015 · 7 comments

Comments

@smaug----
Copy link
Collaborator

Currently the spec just says "indicates whether the user agent should restore the persisted scroll position" which means nothing. Scroll position of the viewport? what about nested iframes, what about scroll status of
the <textarea> ? scrolling of <select size>1>? <div style="overflow: scroll"></div> ?

@smaug----
Copy link
Collaborator Author

@majido

@smaug----
Copy link
Collaborator Author

This is especially about cross-page session history navigations.

@sicking
Copy link

sicking commented Nov 18, 2015

A page can only affect it's restoration behavior when it itself is navigated back to, right?

But yes, we should define which scroll restoration is affected here. One tricky thing is that I think different browsers restore scroll positions of different things. I don't even know what Gecko does and does not restore.

The simplest solution is likely to start making "manual" not restore scroll positions of anything. Including scroll positions of viewports of subdocuments or scrollable areas inside such subdocuments.

@smaug----
Copy link
Collaborator Author

yeah, I think I could live with "manual" not restoring anything, except subdocuments case is a bit more tricky. What if subdocument has explicitly set its session history entry to have "auto" in order to try to use the normal scrolling mode? This especially in case of cross-origin documents.

@sicking
Copy link

sicking commented Nov 19, 2015

Yeah. Maybe letting each sub document have its own policy is a better idea. So setting the mode to "manual" would disable restoration of the document's viewport as well as restoration of any scrollable in-document areas like <textarea>, <select size>1> and <div style="overflow: scroll"></div>.

But it would not affect restoration inside an <iframe>. But of course the document inside the <iframe> could set its own policy.

@majido
Copy link
Member

majido commented Nov 19, 2015

I agree that sub-documents (frame) scroll restoration policy should be independent of their parent. It was in fact in the original proposed spec but I think it got lost in the translation.

Also, I agree that for the purpose of the discussed use cases, the scrollRestoration:'manual' should cause the user-agent to not restore scroll position of the document viewport and any of its inner scrollables with exception of iframes which have their own scroll restoration mode.

Note, that currently I am not aware of any major browser that restores scroll position of inner scrollable (e.g., <textarea>, and <div style="overflow: scroll"></div>) but I think that is a limitation which may be addressed in the future. We should definitely discuss how better to provide finer grain control when that happens. I don't see anything preventing us to extend the definition of scrollRestoration to address that usecase.

Unfortunately the exact nature of what is being stored and restored by UA is not specified by the spec. I would like that to be specified in more details. That would help with interop and also allows us to do more interesting things such as exposing the actual stored scroll position(s).

@smaug----
Copy link
Collaborator Author

Gecko restores scrolling position of various scrollable areas by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants