mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
Fix keyboard navigation in Autocomplete
This commit is contained in:
parent
66ee79db22
commit
81f48eab83
@ -22,11 +22,11 @@ export default {
|
||||
keydown: e => {
|
||||
if (e.keyCode === 38) {
|
||||
// up
|
||||
this.highlightedItem -= 1;
|
||||
this.highlightAboveItem();
|
||||
}
|
||||
if (e.keyCode === 40) {
|
||||
// down
|
||||
this.highlightedItem += 1;
|
||||
this.highlightBelowItem();
|
||||
}
|
||||
if (e.keyCode === 13) {
|
||||
if (this.highlightedItem > -1) {
|
||||
@ -45,6 +45,18 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
highlightBelowItem() {
|
||||
this.highlightedItem += 1;
|
||||
if (this.highlightedItem > this.popupItems.length - 1) {
|
||||
this.highlightedItem = this.popupItems.length - 1;
|
||||
}
|
||||
},
|
||||
highlightAboveItem() {
|
||||
this.highlightedItem -= 1;
|
||||
if (this.highlightedItem < 0) {
|
||||
this.highlightedItem = 0;
|
||||
}
|
||||
},
|
||||
getChildrenElement(h) {
|
||||
return [
|
||||
this.onlyInput ? null : this.getLabelElement(h),
|
||||
|
Loading…
Reference in New Issue
Block a user