Blur global search input on ESC

pull/7085/head
Wieland Lindenthal 6 years ago
parent 3434809b38
commit 44f5fb1496
  1. 5
      frontend/src/app/modules/global_search/global-search-input.component.html
  2. 4
      frontend/src/app/modules/global_search/global-search-input.component.ts

@ -32,8 +32,9 @@
(open)="openCloseMenu(currentValue)"
(close)="select.filterValue = currentValue"
(change)="onChange($event)"
(clear)="clearSearch()"
(keydown.enter)="onEnterBeforeResultsLoaded()">
(keydown.enter)="onEnterBeforeResultsLoaded()"
(keydown.escape)="blur()"
(clear)="clearSearch()">
<ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm">
<div *ngIf="!item.id; else workPackageItemTemplate">
<div tabindex="-1" class="global-search--option">

@ -310,6 +310,10 @@ export class GlobalSearchInputComponent implements OnInit, OnDestroy {
}
}
public blur() {
(<HTMLInputElement> document.activeElement).blur();
}
private redirectToWp(id:string) {
window.location = this.PathHelperService.workPackagePath(id) as unknown as Location;
}

Loading…
Cancel
Save