Fix issue where Escape key wouldn't work in Note selector when there was text in the input causing no Notes to match

This commit is contained in:
Jonatan Heyman 2024-10-29 16:20:20 +01:00
parent 946728060d
commit 74e4c6347b

View File

@ -98,9 +98,21 @@
},
onKeydown(event) {
if (event.key === "Escape") {
console.log("escape")
event.preventDefault()
if (this.actionButton !== 0) {
this.hideActionButtons()
} else {
this.$emit("close")
}
return
}
if (this.filteredItems.length === 0) {
return
}
const path = this.filteredItems[this.selected].path
if (event.key === "ArrowDown") {
if (this.selected === this.filteredItems.length - 1) {
@ -145,13 +157,6 @@
} else {
this.selectItem(path)
}
} else if (event.key === "Escape") {
event.preventDefault()
if (this.actionButton !== 0) {
this.hideActionButtons()
} else {
this.$emit("close")
}
}
},