diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html
index f493b632156..7122e62604b 100644
--- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html
+++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html
@@ -5,6 +5,7 @@
[attr.aria-labelledby]="'sidebarName-' + section.id"
[title]="('menu.section.icon.' + section.id) | translate"
[routerLink]="itemModel.link"
+ (keyup.space)="navigate($event)"
href="javascript:void(0);"
>
diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts
index 66a4c3b28bc..900ade878ed 100644
--- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts
+++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts
@@ -6,6 +6,7 @@ import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorat
import { LinkMenuItemModel } from '../../../shared/menu/menu-item/models/link.model';
import { MenuSection } from '../../../shared/menu/menu.reducer';
import { isNotEmpty } from '../../../shared/empty.util';
+import { Router } from '@angular/router';
/**
* Represents a non-expandable section in the admin sidebar
@@ -26,7 +27,12 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
menuID: MenuID = MenuID.ADMIN;
itemModel;
hasLink: boolean;
- constructor(@Inject('sectionDataProvider') menuSection: MenuSection, protected menuService: MenuService, protected injector: Injector,) {
+ constructor(
+ @Inject('sectionDataProvider') menuSection: MenuSection,
+ protected menuService: MenuService,
+ protected injector: Injector,
+ protected router: Router,
+ ) {
super(menuSection, menuService, injector);
this.itemModel = menuSection.model as LinkMenuItemModel;
}
@@ -35,4 +41,11 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
this.hasLink = isNotEmpty(this.itemModel?.link);
super.ngOnInit();
}
+
+ navigate(event: any): void {
+ event.stopPropagation();
+ if (this.hasLink) {
+ this.router.navigate(this.itemModel.link);
+ }
+ }
}
diff --git a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts
index 07a26485a87..b1f3a63c06e 100644
--- a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts
+++ b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts
@@ -26,6 +26,7 @@ describe('ExpandableAdminSidebarSectionComponent', () => {
{ provide: 'sectionDataProvider', useValue: { icon: iconString } },
{ provide: MenuService, useValue: menuService },
{ provide: CSSVariableService, useClass: CSSVariableServiceStub },
+ { provide: Router, useValue: new RouterStub() },
]
}).overrideComponent(ExpandableAdminSidebarSectionComponent, {
set: {
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 df71433bbbc..aaa6a85c518 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
@@ -9,6 +9,7 @@ import { MenuService } from '../../../shared/menu/menu.service';
import { combineLatest as combineLatestObservable, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorator';
+import { Router } from '@angular/router';
/**
* Represents a expandable section in the sidebar
@@ -49,9 +50,14 @@ export class ExpandableAdminSidebarSectionComponent extends AdminSidebarSectionC
*/
expanded: Observable;
- constructor(@Inject('sectionDataProvider') menuSection, protected menuService: MenuService,
- private variableService: CSSVariableService, protected injector: Injector) {
- super(menuSection, menuService, injector);
+ constructor(
+ @Inject('sectionDataProvider') menuSection,
+ protected menuService: MenuService,
+ private variableService: CSSVariableService,
+ protected injector: Injector,
+ protected router: Router,
+ ) {
+ super(menuSection, menuService, injector, router);
}
/**