Focus next element on Enter
This commit is contained in:
parent
c3a1564c4e
commit
3bd5845068
@ -56,6 +56,12 @@ export default defineComponent({
|
||||
if(e.key == "Enter") {
|
||||
const selected = this.$data.Suggestions[0];
|
||||
this.selectElement(selected);
|
||||
const el = (<HTMLInputElement>e.target);
|
||||
const inputElements = Array.from(el.ownerDocument.querySelectorAll('input:not([disabled]):not([readonly])'));
|
||||
const currentIndex = inputElements.indexOf(el);
|
||||
const nextElement = inputElements[currentIndex < inputElements.length - 1 ? currentIndex + 1 : 0];
|
||||
(<HTMLInputElement>nextElement).focus();
|
||||
|
||||
}
|
||||
},
|
||||
selectElement(element : Suggestion) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user