Merge pull request #29 from KevinMidboe/fix/search-input-navigation-resets-cursor
Reset search-input cursor on upwards navigation
This commit is contained in:
		| @@ -3,6 +3,7 @@ | |||||||
|      |      | ||||||
|     <div class="search"> |     <div class="search"> | ||||||
|       <input |       <input | ||||||
|  |         ref="input" | ||||||
|         type="text" |         type="text" | ||||||
|         placeholder="Search for a movie or show" |         placeholder="Search for a movie or show" | ||||||
|         autocorrect="off" |         autocorrect="off" | ||||||
| @@ -93,6 +94,13 @@ export default { | |||||||
|     navigateUp() { |     navigateUp() { | ||||||
|       this.focus = true |       this.focus = true | ||||||
|       this.selectedResult-- |       this.selectedResult-- | ||||||
|  |       const input = this.$refs.input; | ||||||
|  |       const textLength = input.value.length | ||||||
|  |  | ||||||
|  |       setTimeout(() => { | ||||||
|  |         input.focus() | ||||||
|  |         input.setSelectionRange(textLength, textLength + 1) | ||||||
|  |       }, 1) | ||||||
|     }, |     }, | ||||||
|     handleInput(e){ |     handleInput(e){ | ||||||
|       this.selectedResult = 0 |       this.selectedResult = 0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user