Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

detached -> attached = Scroll position lost  #84

@robrez

Description

@robrez

I'm using a core-list inside of core-pages.

The scroll position is lost if I switch to another page, then back to the page containing the core-list.

I do have a custom component wrapping the core-list element and I was able to workaround the issue like so:

detached: function() {
    this._saveFirstVisible = this.$.list._getFirstVisibleIndex();
}
domReady: function() {
    if(this._saveFirstVisible) {
        this.$.list.scrollToItem(this._saveFirstVisible);
        this._saveFirstVisible = 0;
    }
}

This seems to work but I'm really not sure if there's a chance that detached executes too late and getFirstVisibleIndex won't work... and I'm also not thinking it's a great idea for me to call a private function.

edit: saving off scrollTarget.scrollTop may be better

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions