Commits

Alexandre Vryghem authored and github-actions[bot] committed b9b1d3fd8dc
116404: Added navigation with arrow keys in navbar & collapsed the expandable menu when hovering outside of it

(cherry picked from commit 05232cdf2b068223c8147ed61afe364fc92986d1)
No tags

src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html

Modified
1 -<div class="ds-menu-item-wrapper text-md-center"
2 - [id]="'expandable-navbar-section-' + section.id"
3 - (mouseenter)="onMouseEnter($event)"
4 - (mouseleave)="onMouseLeave($event)"
5 - data-test="navbar-section-wrapper">
6 - <a href="javascript:void(0);" routerLinkActive="active"
7 - role="menuitem"
8 - (keyup.enter)="toggleSection($event)"
9 - (keyup.space)="toggleSection($event)"
10 - (click)="toggleSection($event)"
11 - (keydown.space)="$event.preventDefault()"
12 - (keydown.tab)="deactivateSection($event, false)"
13 - aria-haspopup="menu"
14 - data-test="navbar-section-toggler"
15 - [attr.aria-expanded]="(active$ | async).valueOf()"
16 - [attr.aria-controls]="expandableNavbarSectionId(section.id)"
17 - class="d-flex flex-row flex-nowrap align-items-center gapx-1 ds-menu-toggler-wrapper"
18 - [class.disabled]="section.model?.disabled">
1 +<div #expandableNavbarSectionContainer class="ds-menu-item-wrapper text-md-center"
2 + [id]="'expandable-navbar-section-' + section.id"
3 + (mouseenter)="onMouseEnter($event)"
4 + (mouseleave)="onMouseLeave($event)"
5 + data-test="navbar-section-wrapper">
6 + <a href="javascript:void(0);" routerLinkActive="active"
7 + role="menuitem"
8 + (keyup.enter)="toggleSection($event)"
9 + (keyup.space)="toggleSection($event)"
10 + (click)="toggleSection($event)"
11 + (keydown)="keyDown($event)"
12 + aria-haspopup="menu"
13 + data-test="navbar-section-toggler"
14 + [attr.aria-expanded]="(active$ | async).valueOf()"
15 + [attr.aria-controls]="expandableNavbarSectionId()"
16 + class="d-flex flex-row flex-nowrap align-items-center gapx-1 ds-menu-toggler-wrapper"
17 + [class.disabled]="section.model?.disabled">
19 18 <span class="flex-fill">
20 19 <ng-container
21 20 *ngComponentOutlet="(sectionMap$ | async).get(section.id).component; injector: (sectionMap$ | async).get(section.id).injector;"></ng-container>
22 21 </span>
23 - <i class="fas fa-caret-down fa-xs toggle-menu-icon" aria-hidden="true"></i>
24 - </a>
25 - <div *ngIf="(active$ | async).valueOf() === true" (click)="deactivateSection($event)"
26 - [id]="expandableNavbarSectionId(section.id)"
27 - role="menu"
28 - class="dropdown-menu show nav-dropdown-menu m-0 shadow-none border-top-0 px-3 px-md-0 pt-0 pt-md-1">
29 - <div @slide role="presentation">
30 - <div *ngFor="let subSection of (subSections$ | async)" class="text-nowrap" role="presentation">
31 - <ng-container
32 - *ngComponentOutlet="(sectionMap$ | async).get(subSection.id).component; injector: (sectionMap$ | async).get(subSection.id).injector;"></ng-container>
33 - </div>
22 + <i class="fas fa-caret-down fa-xs toggle-menu-icon" aria-hidden="true"></i>
23 + </a>
24 + <div *ngIf="(active$ | async).valueOf() === true" (click)="deactivateSection($event)"
25 + [id]="expandableNavbarSectionId()"
26 + [dsHoverOutsideOfElement]="expandableNavbarSection"
27 + (dsHoverOutside)="deactivateSection($event, false)"
28 + role="menu"
29 + class="dropdown-menu show nav-dropdown-menu m-0 shadow-none border-top-0 px-3 px-md-0 pt-0 pt-md-1">
30 + <div @slide role="presentation">
31 + <div *ngFor="let subSection of (subSections$ | async)" class="text-nowrap" role="presentation">
32 + <ng-container
33 + *ngComponentOutlet="(sectionMap$ | async).get(subSection.id).component; injector: (sectionMap$ | async).get(subSection.id).injector;"></ng-container>
34 34 </div>
35 35 </div>
36 + </div>
36 37 </div>

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut