Skip to content

aio: retain previous scroll position #17308

Closed

Description

@wardbell

With our current scrolling, when you return to a page that you’ve seen before, the app scrolls either to top or the bookmark in the URL. That means if you bounce between two guides, you lose your place.

For example:

  1. Go to QuickStart
  2. Scroll down near bottom
  3. Go to CLI QuickStart
  4. Go back to QuickStart

Notice that you’re at the TOP of QuickStart, not down where you were.

That isn’t how browser pages usually work. The browser typically remembers where you were and leaves you there. You can see this behavior by commenting out ALL scrolling within app.component.ts.

I propose that we implement that behavior.

We could achieve that by caching the last URL to a page as well as the page itself. If you navigate to a page with the same URL as is in cache, no scroll. If the URL has changed, update cache and scroll.

@IgorMinar writes:

The solution should be implemented via location.pushState and I don’t want to go there now. We should definitely not build up a parallel history stack to the one that’s already in the browser

That is worth exploring when we get to it.

On June 7th we agreed to defer this issue until after release.

Activity

  1. self-assigned this
    on Jun 7, 2017
  2. added this to the Backlog milestone on Jan 23, 2018
  3. gkalpak commented on Dec 22, 2019

    @gkalpak
    Member

    With #28037, we now have scroll position restoration when navigating forward/backward in history. I think this covers it (given Igor's comment to go through pushState and not build up a parallel history stack to the one that’s already in the browser).

  4. angular-automatic-lock-bot commented on Jan 22, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions