Skip to content

Commit 7f0291c

Browse files
authored
fix: cancel input blur when input is refocused (#1282)
1 parent 83e1db6 commit 7f0291c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

app/components/Compare/PackageSelector.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,17 @@ function handleKeydown(e: KeyboardEvent) {
9292
}
9393
}
9494
95+
const { start, stop } = useTimeoutFn(() => {
96+
isInputFocused.value = false
97+
}, 200)
98+
9599
function handleBlur() {
96-
useTimeoutFn(() => {
97-
isInputFocused.value = false
98-
}, 200)
100+
start()
101+
}
102+
103+
function handleFocus() {
104+
stop()
105+
isInputFocused.value = true
99106
}
100107
</script>
101108

@@ -151,7 +158,7 @@ function handleBlur() {
151158
size="medium"
152159
class="w-full min-w-25 ps-7"
153160
aria-autocomplete="list"
154-
@focus="isInputFocused = true"
161+
@focus="handleFocus"
155162
@blur="handleBlur"
156163
@keydown="handleKeydown"
157164
/>

0 commit comments

Comments
 (0)