OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Focus arrow so that the currently focused element is inside the menu and the menu does not close (mobile)
Henriette Dinger822fb56209d7
diff --git a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts b/frontend/src/app/components/main-menu/main-menu-toggle.service.tsindex 82c44fd9aa8..afd40ec61d0 100644--- a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts+++ b/frontend/src/app/components/main-menu/main-menu-toggle.service.ts@@ -104,7 +104,7 @@ export class MainMenuToggleService {this.closeMenu();}- this.addRemoveClassHidden();+ this.toggleClassHidden();this.setToggleTitle();// 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@@ -138,7 +138,7 @@ export class MainMenuToggleService {this.titleData.next(this.toggleTitle);}- private addRemoveClassHidden():void {+ private toggleClassHidden():void {this.hideElements.toggleClass('hidden-navigation', !this.showNavigation);}@@ -169,7 +169,7 @@ export class MainMenuToggleService {this.ensureContentVisibility();this.global.showNavigation = this.showNavigation;- this.addRemoveClassHidden();+ this.toggleClassHidden();this.htmlNode.style.setProperty("--main-menu-width", this.elementWidth + 'px');}@@ -180,14 +180,13 @@ export class MainMenuToggleService {let originalEvent = event.originalEvent as FocusEvent;// Check that main menu is not closed and that the `focusout` event is not a click on an element// that tries to close the menu anyways.- if (!that.showNavigation || document.getElementById('main-menu-toggle') === originalEvent.relatedTarget) {+ if (!that.showNavigation || document.getElementById('main-menu-toggle') === originalEvent.relatedTarget) {return;}else {// There might be a time gap between `focusout` and the focussing of the activeElement, thus we need a timeout.setTimeout(function() {- if (!jQuery.contains(document.getElementById('main-menu')!, document.activeElement!) &&- (document.getElementById('main-menu-toggle') !== document.activeElement)) {+ if (!jQuery.contains(document.getElementById('main-menu')!, originalEvent.relatedTarget as Element)) {// activeElement is outside of main menu.that.closeMenu();}diff --git a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.tsindex 2c8896d8023..c06f2f6c651 100644--- a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts+++ b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts@@ -1,4 +1,4 @@-import {Component} from "@angular/core";+import {Component, OnInit} from "@angular/core";import {Observable} from "rxjs";import {BoardService} from "core-app/modules/boards/board/board.service";import {Board} from "core-app/modules/boards/board/board";@@ -14,7 +14,7 @@ import {CurrentProjectService} from "core-components/projects/current-project.setemplateUrl: './boards-menu.component.html'})-export class BoardsMenuComponent {+export class BoardsMenuComponent implements OnInit {trackById = AngularTrackingHelpers.compareByAttribute('id');currentProjectIdentifier = this.currentProject.identifier;@@ -33,12 +33,22 @@ export class BoardsMenuComponent {private readonly boardCache:BoardCacheService,private readonly currentProject:CurrentProjectService,private readonly mainMenuService:MainMenuNavigationService) {+ }+ ngOnInit() {// When activating the work packages submenu,// either initially or through click on the toggle, load the resultsthis.mainMenuService.onActivate('board_view')- .subscribe(() => this.boardService.loadAllBoards());+ .subscribe(() => {+ this.focusBackArrow();+ this.boardService.loadAllBoards()+ });+ }++ private focusBackArrow() {+ let buttonArrowLeft = jQuery('*[data-name="board_view"] .main-menu--arrow-left-to-project');+ buttonArrowLeft.focus();}}DynamicBootstrapper.register({selector: 'boards-menu', cls: BoardsMenuComponent});