Skip to content

Commit

Permalink
chore(isct-351): add timeout for menu state open/close on start fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyKIron committed Jul 10, 2024
1 parent 374b921 commit 618ddc8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[menuHoverMode]="primaryMenuItemMode === 'hoverToShowSecondaryItems'"
(primaryMenuItemClicked)="onPrimaryMainMenuItemClicked($event)"
(changeColorTheme)="onChangeColorTheme($event)"
(toggleMenu)="toggleMenu($event)"
(toggleMenu)="toggleMenu()"
(resetSecondaryMenu)="resetSecondaryMenu()"
(menuItemClick)="onMenuItemClicked($event, true)"
></fusion-navigation-primary-menu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export class NavigationMenuComponent implements OnInit {
.subscribe(this.onNavigationMenuMouseLeave.bind(this));

if (this.selectedPrimaryMenuItem?.type !== NavigationBarItemType.Main && this.secondaryMenuOpen$.getValue()) {
this.secondaryMenuOpen$.next(false);
// if started from primary menu item that have NOT children and secondary menu is open
setTimeout(() => {
this.secondaryMenuOpen$.next(false);
});
}
}

Expand Down Expand Up @@ -155,13 +158,11 @@ export class NavigationMenuComponent implements OnInit {
this.setNetworkTheme(cssTheme);
}

toggleMenu($event?: MouseEvent) {
toggleMenu() {
if (!(this.secondaryMenuOpen$.getValue() && this.secondaryMenuExpanded$.getValue())) {
this.secondaryMenuOpen$.next(!this.secondaryMenuOpen$.getValue() && this.secondaryMenuItems$.getValue().length > 0);
}
if (($event?.currentTarget as Element)?.matches('.fu-menu-toggle')) {
this.storageService.set(StorageType.SessionStorage, MENU_CACHE_KEY, this.secondaryMenuOpen$.getValue());
}
this.storageService.set(StorageType.SessionStorage, MENU_CACHE_KEY, this.secondaryMenuOpen$.getValue());
if (this.secondaryMenuOpen$.getValue()) {
if (this.needRestoreSelectedState) {
this.setSecondaryMenu(this.selectedPrimaryMenuItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class NavigationPrimaryMenuComponent {

menuToggleButtonClicked($event: MouseEvent) {
this.menuToggleCollapsed$.next(this.menuOpened && !this.menuExpanded);
this.toggleMenu.emit($event);
this.toggleMenu.emit();
}

private parseNavigationBarItems(value: PrimaryMenuItem[]) {
Expand Down

0 comments on commit 618ddc8

Please sign in to comment.