2
0
mirror of https://github.com/frappe/books.git synced 2025-01-24 15:48:25 +00:00

fix: prevent wonky dropdown key scrolling

This commit is contained in:
18alantom 2022-10-25 14:34:28 +05:30
parent 544eb5128d
commit 3edc050cfb

View File

@ -214,7 +214,9 @@ export default {
await this.selectItem(this.items[0]); await this.selectItem(this.items[0]);
} }
}, },
highlightItemUp() { highlightItemUp(e) {
e?.preventDefault();
this.highlightedIndex -= 1; this.highlightedIndex -= 1;
if (this.highlightedIndex < 0) { if (this.highlightedIndex < 0) {
this.highlightedIndex = 0; this.highlightedIndex = 0;
@ -227,7 +229,9 @@ export default {
this.scrollToHighlighted(); this.scrollToHighlighted();
}); });
}, },
highlightItemDown() { highlightItemDown(e) {
e?.preventDefault();
this.highlightedIndex += 1; this.highlightedIndex += 1;
if (this.highlightedIndex > this.items.length) { if (this.highlightedIndex > this.items.length) {
this.highlightedIndex = this.items.length; this.highlightedIndex = this.items.length;