mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 23:43:01 +00:00
81901: Fix navigation/onclick function ~ enter key
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
[title]="('menu.section.icon.' + section.id) | translate"
|
[title]="('menu.section.icon.' + section.id) | translate"
|
||||||
[routerLink]="itemModel.link"
|
[routerLink]="itemModel.link"
|
||||||
(keyup.space)="navigate($event)"
|
(keyup.space)="navigate($event)"
|
||||||
|
(keyup.enter)="navigate($event)"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
>
|
>
|
||||||
<div class="shortcut-icon">
|
<div class="shortcut-icon">
|
||||||
|
@@ -43,7 +43,7 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigate(event: any): void {
|
navigate(event: any): void {
|
||||||
event.stopPropagation();
|
event.preventDefault();
|
||||||
if (this.hasLink) {
|
if (this.hasLink) {
|
||||||
this.router.navigate(this.itemModel.link);
|
this.router.navigate(this.itemModel.link);
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
<a class="nav-item nav-link sidebar-section d-flex flex-row flex-nowrap"
|
<a class="nav-item nav-link sidebar-section d-flex flex-row flex-nowrap"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
(click)="toggle($event)"
|
(click)="toggle($event)"
|
||||||
(keyup.space)="$event.stopPropagation(); toggle($event)"
|
(keyup.space)="toggle($event)"
|
||||||
>
|
>
|
||||||
<div class="shortcut-icon">
|
<div class="shortcut-icon">
|
||||||
<i *ngIf="(menuCollapsed | async)" class="fas fa-fw fa-angle-double-right"
|
<i *ngIf="(menuCollapsed | async)" class="fas fa-fw fa-angle-double-right"
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
[attr.aria-expanded]="expanded | async"
|
[attr.aria-expanded]="expanded | async"
|
||||||
[title]="('menu.section.icon.' + section.id) | translate"
|
[title]="('menu.section.icon.' + section.id) | translate"
|
||||||
(click)="toggleSection($event)"
|
(click)="toggleSection($event)"
|
||||||
(keyup.space)="$event.stopPropagation(); toggleSection($event)"
|
(keyup.space)="toggleSection($event)"
|
||||||
|
(keyup.enter)="toggleSection($event)"
|
||||||
>
|
>
|
||||||
<div class="shortcut-icon h-100">
|
<div class="shortcut-icon h-100">
|
||||||
<i class="fas fa-{{section.icon}} fa-fw"></i>
|
<i class="fas fa-{{section.icon}} fa-fw"></i>
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
[attr.aria-disabled]="!hasLink"
|
[attr.aria-disabled]="!hasLink"
|
||||||
[title]="item.text"
|
[title]="item.text"
|
||||||
[routerLink]="getRouterLink()"
|
[routerLink]="getRouterLink()"
|
||||||
|
(click)="$event.stopPropagation()"
|
||||||
(keyup.space)="navigate($event)"
|
(keyup.space)="navigate($event)"
|
||||||
|
(keyup.enter)="navigate($event)"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
>{{item.text | translate}}</a>
|
>{{item.text | translate}}</a>
|
||||||
|
@@ -36,10 +36,11 @@ export class LinkMenuItemComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigate(event: any) {
|
navigate(event: any) {
|
||||||
event.stopPropagation();
|
event.preventDefault();
|
||||||
if (this.getRouterLink()) {
|
if (this.getRouterLink()) {
|
||||||
this.router.navigate([this.getRouterLink()]);
|
this.router.navigate([this.getRouterLink()]);
|
||||||
}
|
}
|
||||||
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
class="nav-item nav-link"
|
class="nav-item nav-link"
|
||||||
role="button"
|
role="button"
|
||||||
[title]="item.text"
|
[title]="item.text"
|
||||||
(click)="item.function()"
|
(click)="activate($event)"
|
||||||
(keyup.space)="$event.stopPropagation(); item.function()"
|
(keyup.space)="activate($event)"
|
||||||
|
(keyup.enter)="activate($event)"
|
||||||
>{{item.text | translate}}</a>
|
>{{item.text | translate}}</a>
|
||||||
|
@@ -17,4 +17,10 @@ export class OnClickMenuItemComponent {
|
|||||||
constructor(@Inject('itemModelProvider') item: OnClickMenuItemModel) {
|
constructor(@Inject('itemModelProvider') item: OnClickMenuItemModel) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public activate(event: any) {
|
||||||
|
event.preventDefault();
|
||||||
|
this.item.function();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user