Skip to content

Commit 17e0333

Browse files
116404: Don't navigate in the expandable navbar section with tab
Had to move the @slide animation to prevent focus being lost when tabbing in the expandable section (cherry picked from commit c08c272)
1 parent ed27231 commit 17e0333

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
(keyup.space)="toggleSection($event)"
1010
(click)="toggleSection($event)"
1111
(keydown.space)="$event.preventDefault()"
12+
(keydown.tab)="deactivateSection($event, false)"
1213
aria-haspopup="menu"
1314
data-test="navbar-section-toggler"
1415
[attr.aria-expanded]="(active$ | async).valueOf()"
@@ -21,13 +22,15 @@
2122
</span>
2223
<i class="fas fa-caret-down fa-xs toggle-menu-icon" aria-hidden="true"></i>
2324
</a>
24-
<div @slide *ngIf="(active$ | async).valueOf() === true" (click)="deactivateSection($event)"
25+
<div *ngIf="(active$ | async).valueOf() === true" (click)="deactivateSection($event)"
2526
[id]="expandableNavbarSectionId(section.id)"
2627
role="menu"
2728
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">
2830
<div *ngFor="let subSection of (subSections$ | async)" class="text-nowrap" role="presentation">
29-
<ng-container
30-
*ngComponentOutlet="(sectionMap$ | async).get(subSection.id).component; injector: (sectionMap$ | async).get(subSection.id).injector;"></ng-container>
31-
</div>
31+
<ng-container
32+
*ngComponentOutlet="(sectionMap$ | async).get(subSection.id).component; injector: (sectionMap$ | async).get(subSection.id).injector;"></ng-container>
33+
</div>
34+
</div>
3235
</div>
3336
</div>

src/app/shared/menu/menu-section/menu-section.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,14 @@ export class MenuSectionComponent implements OnInit, OnDestroy {
102102

103103
/**
104104
* Deactivate this section
105+
*
105106
* @param {Event} event The user event that triggered this method
107+
* @param skipEvent Weather the event should still be triggered after deactivating the section or not
106108
*/
107-
deactivateSection(event: Event) {
108-
event.preventDefault();
109+
deactivateSection(event: Event, skipEvent = true): void {
110+
if (skipEvent) {
111+
event.preventDefault();
112+
}
109113
this.menuService.deactivateSection(this.menuID, this.section.id);
110114
}
111115

0 commit comments

Comments
 (0)