diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/header/search-typeahead.component.html | 2 | ||||
-rw-r--r-- | client/src/app/header/search-typeahead.component.ts | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/client/src/app/header/search-typeahead.component.html b/client/src/app/header/search-typeahead.component.html index 46b28ed48..710268664 100644 --- a/client/src/app/header/search-typeahead.component.html +++ b/client/src/app/header/search-typeahead.component.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <div class="d-inline-flex position-relative" id="typeahead-container"> | 1 | <div class="d-inline-flex position-relative" id="typeahead-container"> |
2 | <input | 2 | <input |
3 | type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…" | 3 | type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…" |
4 | [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKeyUp($event)" | 4 | [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKey($event)" (keydown.enter)="doSearch()" |
5 | > | 5 | > |
6 | <span class="icon icon-search" (click)="doSearch()"></span> | 6 | <span class="icon icon-search" (click)="doSearch()"></span> |
7 | 7 | ||
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts index 396a875c8..d0350368d 100644 --- a/client/src/app/header/search-typeahead.component.ts +++ b/client/src/app/header/search-typeahead.component.ts | |||
@@ -134,7 +134,7 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy { | |||
134 | ) | 134 | ) |
135 | } | 135 | } |
136 | 136 | ||
137 | handleKeyUp (event: KeyboardEvent) { | 137 | handleKey (event: KeyboardEvent) { |
138 | event.stopImmediatePropagation() | 138 | event.stopImmediatePropagation() |
139 | if (!this.keyboardEventsManager) return | 139 | if (!this.keyboardEventsManager) return |
140 | 140 | ||
@@ -143,14 +143,11 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy { | |||
143 | case 'ArrowUp': | 143 | case 'ArrowUp': |
144 | this.keyboardEventsManager.onKeydown(event) | 144 | this.keyboardEventsManager.onKeydown(event) |
145 | break | 145 | break |
146 | case 'Enter': | ||
147 | this.newSearch = false | ||
148 | this.doSearch() | ||
149 | break | ||
150 | } | 146 | } |
151 | } | 147 | } |
152 | 148 | ||
153 | doSearch () { | 149 | doSearch () { |
150 | this.newSearch = false | ||
154 | const queryParams: Params = {} | 151 | const queryParams: Params = {} |
155 | 152 | ||
156 | if (window.location.pathname === '/search' && this.route.snapshot.queryParams) { | 153 | if (window.location.pathname === '/search' && this.route.snapshot.queryParams) { |