2
0
mirror of https://github.com/frappe/books.git synced 2024-11-13 00:46:28 +00:00

fix(Dropdown): Natural keyboard navigation

This commit is contained in:
Faris Ansari 2019-12-03 13:51:50 +05:30
parent dfc6c44886
commit c63897f888

View File

@ -147,8 +147,7 @@ export default {
if (index !== 0) {
index -= 1;
}
let highlightedElement = this.$refs.items[index];
highlightedElement && highlightedElement.scrollIntoView();
this.scrollToHighlighted();
});
},
highlightItemDown() {
@ -158,10 +157,13 @@ export default {
}
this.$nextTick(() => {
let index = this.highlightedIndex;
let highlightedElement = this.$refs.items[index];
highlightedElement && highlightedElement.scrollIntoView();
this.scrollToHighlighted();
});
},
scrollToHighlighted() {
let highlightedElement = this.$refs.items[this.highlightedIndex];
highlightedElement &&
highlightedElement.scrollIntoView({ block: 'nearest' });
}
}
};