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

Commit

Permalink
Scroll to top if data changes
Browse files Browse the repository at this point in the history
The problem: 
When reusing core-doc-page for multiple docs, scroll position is preserved when docs change. It is a bad user experience, you end up looking at the middle of a freshly loaded doc.
The fix:
Scroll to top when user data changes.
Question:
Is there a way to do this without traversing core-header-panel's internal structure? Hate doing that...
  • Loading branch information
atotic committed Dec 17, 2014
1 parent 2e351a1 commit a619e1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elements/core-doc-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ <h3 id="{{data.name}}.methods">Methods</h3>
if (elementToFocus) {
elementToFocus.scrollIntoView();
}
else {
var viewer = this.shadowRoot.querySelector('core-header-panel /deep/ #mainContainer');
viewer.scrollTop = 0;
viewer.scrollLeft = 0;
}
});
}

Expand Down

0 comments on commit a619e1f

Please sign in to comment.