Skip to content

Commit

Permalink
docs: close nav when resetting scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Mar 12, 2020
1 parent 566b3ef commit 15e5282
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion documentation/src/components/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class LayoutElement extends LitElement {
this.open = !this.open;
}

closeNav() {
this.open = false;
}

private updateColor(event: Event) {
this.color = (event.target as Dropdown).value as Color;
}
Expand Down Expand Up @@ -131,7 +135,7 @@ export class LayoutElement extends LitElement {
id="side-nav"
?inert=${!this.open}
?open=${this.open}
@close=${this.toggleNav}
@close=${this.closeNav}
></docs-side-nav>
<main id="layout-content" ?inert=${this.open} role="main">
<div id="page">
Expand Down
1 change: 1 addition & 0 deletions documentation/src/components/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class Page extends LayoutElement {
if (!this.contentElement) return;

this.contentElement.scroll(0, 0);
this.open = false;
}
}

Expand Down

0 comments on commit 15e5282

Please sign in to comment.