Skip to content

Commit

Permalink
set focus on first element of menu
Browse files Browse the repository at this point in the history
  • Loading branch information
bsatarnejad committed Nov 17, 2024
1 parent f5addf2 commit b3347e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/app/core/main-menu/main-menu-toggle.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,14 @@ export class MainMenuToggleService {
} else {
this.openMenu();
}

// Save the collapsed state in localStorage
window.OpenProject.guardedLocalStorage(this.localStorageStateKey, String(!this.showNavigation));
// Set focus on first visible main menu item.
// This needs to be called after AngularJS has rendered the menu, which happens some when after(!) we leave this
// method here. So we need to set the focus after a timeout.
setTimeout(() => {
jQuery('#main-menu [class*="-menu-item"]:visible').first().focus();
}, 500);
}

public closeMenu():void {
Expand Down

0 comments on commit b3347e1

Please sign in to comment.