-
Notifications
You must be signed in to change notification settings - Fork 26
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
Revamp intercepted-navigation scroll handling #239
Conversation
This changes the default behavior of intercepted navigations with respect to scrolling in the following ways: * Scroll restoration is performed on reloads, not just traverses. * For pushes and replaces, we either scroll to the top or scroll to the fragment. This change requires some updated API surface: the scrollRestoration option to intercept() has become scroll, and the navigateEvent.restoreScroll() method has become navigateEvent.scroll(). The latter method now has more capabilities, working to give browser-default-like behavior for "push", "replace", and "reload" in addition to "traverse". Similar to before, all of this can be opted out of by using scroll: "manual". Closes #237 by giving an easy default behavior for SPA navigations with hashes. Closes #231 by making "push", "replace", and "reload" behave by default in an MPA-like manner with respect to scroll position, just like "traverse" does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@domenic could I interest you in a { scroll: 'auto' }
default, that acts like after-transition
, unless navigateEvent.scroll()
is called before the intercept promise settles?
Hmm, I wonder if we should just make that the behavior of "after-transition"... |
Yeah, that makes sense |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple nitpicks
Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b
Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026382}
Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026382}
…ation scroll handling, a=testonly Automatic update from web-platform-tests Navigation API: Revamp intercepted-navigation scroll handling Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026382} -- wpt-commits: 5fb15e04adca47cc972a2e4c665853aca6a1a5b9 wpt-pr: 34919
…ation scroll handling, a=testonly Automatic update from web-platform-tests Navigation API: Revamp intercepted-navigation scroll handling Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026382} -- wpt-commits: 5fb15e04adca47cc972a2e4c665853aca6a1a5b9 wpt-pr: 34919
Follows WICG/navigation-api#239 Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s Bug: 1345507 Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026382} NOKEYCHECK=True GitOrigin-RevId: d64518f92c71b650d1b5f83dbfae7d434bfc95bf
This changes the default behavior of intercepted navigations with respect to scrolling in the following ways:
This change requires some updated API surface: the scrollRestoration option to intercept() has become scroll, and the navigateEvent.restoreScroll() method has become navigateEvent.scroll(). The latter method now has more capabilities, working to give browser-default-like behavior for "push", "replace", and "reload" in addition to "traverse".
Similar to before, all of this can be opted out of by using scroll: "manual".
Closes #237 by giving an easy default behavior for SPA navigations with hashes.
Closes #231 by making "push", "replace", and "reload" behave by default in an MPA-like manner with respect to scroll position, just like "traverse" does.
Preview | Diff