MOBILE-3749 a11y: Implement cancel key on pages
parent
c3d0e39c3e
commit
4e643a363e
|
@ -7,7 +7,7 @@
|
|||
<ion-title>{{ 'core.login.reconnect' | translate }}</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content class="ion-padding">
|
||||
<ion-content class="ion-padding" (keydown)="keyDown($event)" (keyup)="keyUp($event)">
|
||||
<div class="ion-text-wrap ion-text-center ion-margin-bottom" [ngClass]="{'item-avatar-center': showSiteAvatar}">
|
||||
<!-- Show user avatar. -->
|
||||
<img *ngIf="showSiteAvatar" [src]="userAvatar" class="large-avatar" core-external-content [siteId]="siteId"
|
||||
|
|
|
@ -271,4 +271,27 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A11y key functionality that prevents keyDown events.
|
||||
*
|
||||
* @param e Event.
|
||||
*/
|
||||
keyDown(e: KeyboardEvent): void {
|
||||
if (e.key == 'Escape') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel reconnect.
|
||||
*
|
||||
* @param e Event.
|
||||
*/
|
||||
keyUp(e: KeyboardEvent): void {
|
||||
if (e.key == 'Escape') {
|
||||
this.cancel(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue