diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-04-07 02:20:24 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-04-07 02:20:26 +0200 |
commit | be6343d26ec07fd792de069229bd3be27e72d129 (patch) | |
tree | 1add575ec520518977f4342f9cb78f0903c0c2c8 /client/src | |
parent | 8323c435c19ac6ed1656ee8436b175bce7bd2c82 (diff) | |
download | PeerTube-be6343d26ec07fd792de069229bd3be27e72d129.tar.gz PeerTube-be6343d26ec07fd792de069229bd3be27e72d129.tar.zst PeerTube-be6343d26ec07fd792de069229bd3be27e72d129.zip |
Fix search after first type on input
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) { |