From ed27231769e61122cb12ad9f145a251b26d4b261 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 5 Jul 2024 10:34:49 +0200 Subject: [PATCH 1/7] 116404: Fixed expandable navbar section loosing focus on expand through keyboard (cherry picked from commit 2547b1218f36f00e1a62522a47d9c9f59dbc91e9) --- .../expandable-admin-sidebar-section.component.ts | 2 +- .../expandable-navbar-section.component.html | 12 +++++------- .../expandable-navbar-section.component.ts | 10 ++++------ .../menu/menu-section/menu-section.component.ts | 8 +++++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts index 1b09d330c2..43d314ecdd 100644 --- a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts +++ b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts @@ -84,7 +84,7 @@ export class ExpandableAdminSidebarSectionComponent extends AdminSidebarSectionC this.sidebarActiveBg$ = this.variableService.getVariable('--ds-admin-sidebar-active-bg'); this.isSidebarCollapsed$ = this.menuService.isMenuCollapsed(this.menuID); this.isSidebarPreviewCollapsed$ = this.menuService.isMenuPreviewCollapsed(this.menuID); - this.isExpanded$ = combineLatestObservable([this.active, this.isSidebarCollapsed$, this.isSidebarPreviewCollapsed$]).pipe( + this.isExpanded$ = combineLatestObservable([this.active$, this.isSidebarCollapsed$, this.isSidebarPreviewCollapsed$]).pipe( map(([active, sidebarCollapsed, sidebarPreviewCollapsed]) => (active && (!sidebarCollapsed || !sidebarPreviewCollapsed))), ); } diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html index 7f9b4a546f..5119cec689 100644 --- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html @@ -1,9 +1,8 @@
+ (mouseenter)="onMouseEnter($event)" + (mouseleave)="onMouseLeave($event)" + data-test="navbar-section-wrapper"> - -
diff --git a/src/app/shared/menu/menu-section/menu-section.component.ts b/src/app/shared/menu/menu-section/menu-section.component.ts index 685ebe6b99..43df73547a 100644 --- a/src/app/shared/menu/menu-section/menu-section.component.ts +++ b/src/app/shared/menu/menu-section/menu-section.component.ts @@ -102,10 +102,14 @@ export class MenuSectionComponent implements OnInit, OnDestroy { /** * Deactivate this section + * * @param {Event} event The user event that triggered this method + * @param skipEvent Weather the event should still be triggered after deactivating the section or not */ - deactivateSection(event: Event) { - event.preventDefault(); + deactivateSection(event: Event, skipEvent = true): void { + if (skipEvent) { + event.preventDefault(); + } this.menuService.deactivateSection(this.menuID, this.section.id); } From b9b1d3fd8dc20684de0e0dbd3e2f7bfd82db900f Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 5 Jul 2024 13:30:01 +0200 Subject: [PATCH 3/7] 116404: Added navigation with arrow keys in navbar & collapsed the expandable menu when hovering outside of it (cherry picked from commit 05232cdf2b068223c8147ed61afe364fc92986d1) --- .../expandable-navbar-section.component.html | 59 +++++----- .../expandable-navbar-section.component.ts | 104 ++++++++++++++++-- .../shared/utils/hover-outside.directive.ts | 51 +++++++++ .../expandable-navbar-section.component.ts | 14 ++- 4 files changed, 185 insertions(+), 43 deletions(-) create mode 100644 src/app/shared/utils/hover-outside.directive.ts diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html index f37fc222d5..f8facaa82a 100644 --- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html @@ -1,36 +1,37 @@ -
- +
+ - - -