File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -183,18 +183,12 @@ watch(highlightedIndex, index => {
183183 }
184184})
185185
186- const { start, stop } = useTimeoutFn (() => {
187- isInputFocused .value = false
188- }, 200 )
189-
190- function handleBlur() {
191- start ()
192- }
186+ const containerRef = useTemplateRef (' containerRef' )
193187
194- function handleFocus() {
195- stop ()
196- isInputFocused .value = true
197- }
188+ onClickOutside ( containerRef , () => {
189+ isInputFocused . value = false
190+ highlightedIndex .value = - 1
191+ })
198192 </script >
199193
200194<template >
@@ -226,7 +220,7 @@ function handleFocus() {
226220 </div >
227221
228222 <!-- Add package input -->
229- <div v-if =" packages.length < maxPackages" class =" relative" >
223+ <div v-if =" packages.length < maxPackages" ref = " containerRef " class =" relative" >
230224 <div class =" relative group flex items-center" >
231225 <label for =" package-search" class =" sr-only" >
232226 {{ $t('compare.selector.search_label') }}
@@ -249,8 +243,8 @@ function handleFocus() {
249243 size =" medium"
250244 class =" w-full min-w-25 ps-7"
251245 aria-autocomplete =" list"
252- @focus = " handleFocus "
253- @blur = " handleBlur "
246+ ref = " inputRef "
247+ @focus = " isInputFocused = true "
254248 @keydown =" handleKeydown"
255249 />
256250 </div >
You can’t perform that action at this time.
0 commit comments