Merge pull request #29 from KevinMidboe/fix/search-input-navigation-resets-cursor

Reset search-input cursor on upwards navigation
This commit is contained in:
2019-10-30 21:57:05 +01:00
committed by GitHub

View File

@@ -3,6 +3,7 @@
<div class="search">
<input
ref="input"
type="text"
placeholder="Search for a movie or show"
autocorrect="off"
@@ -93,6 +94,13 @@ export default {
navigateUp() {
this.focus = true
this.selectedResult--
const input = this.$refs.input;
const textLength = input.value.length
setTimeout(() => {
input.focus()
input.setSelectionRange(textLength, textLength + 1)
}, 1)
},
handleInput(e){
this.selectedResult = 0