Skip to content

Commit

Permalink
fix(vertical-nav): close secondary and tertiary menus upon leaf node …
Browse files Browse the repository at this point in the history
…click (#396)

Fixes #372
  • Loading branch information
dlabrecq committed Jun 22, 2018
1 parent d7e5f59 commit 3117934
Showing 1 changed file with 21 additions and 7 deletions.
Expand Up @@ -697,10 +697,9 @@ export class VerticalNavigationComponent implements OnInit, OnDestroy {

private navigateToItem(item: VerticalNavigationItem): void {
let navItem = this.getFirstNavigateChild(item);
let navTo;
if (navItem) {
this._showMobileNav = false;
navTo = navItem.url;
let navTo = navItem.url;
if (navTo) {
this.router.navigateByUrl(navTo);
}
Expand All @@ -709,17 +708,32 @@ export class VerticalNavigationComponent implements OnInit, OnDestroy {
}
}

if (this.itemClickEvent) {
this.itemClickEvent.emit(item);
}

if (this.updateActiveItemsOnClick) {
this.clearActiveItems();
navItem.trackActiveState = true;
this.setParentActive(navItem);
}

// Dismiss items (leaf nodes) immediately upon click
if (!item.children) {
this._hoverSecondaryNav = false;
this._hoverTertiaryNav = false;
this.items.forEach((primary) => {
if (!this.persistentSecondary) {
primary.trackHoverState = false;
}
if (primary.children !== undefined) {
primary.children.forEach((secondary) => {
if (!this.persistentSecondary) {
secondary.trackHoverState = false;
}
});
}
});
} else {
this.setSecondaryItemVisible();
}
this.setSecondaryItemVisible();
this.itemClickEvent.emit(item);
}

private primaryHover(): boolean {
Expand Down

0 comments on commit 3117934

Please sign in to comment.