File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,11 +15,10 @@ const emit = defineEmits<{
1515 select: [username : string , isInSuggestions : boolean ]
1616}>()
1717
18- const inputValue = ref (' ' )
19- const isOpen = ref (false )
20- const highlightedIndex = ref (- 1 )
21- const inputRef = ref <HTMLInputElement | null >(null )
22- const listRef = ref <HTMLUListElement | null >(null )
18+ const inputValue = shallowRef (' ' )
19+ const isOpen = shallowRef (false )
20+ const highlightedIndex = shallowRef (- 1 )
21+ const listRef = useTemplateRef (' listRef' )
2322
2423// Generate unique ID for accessibility
2524const inputId = useId ()
@@ -134,18 +133,14 @@ watch(highlightedIndex, index => {
134133})
135134
136135// Check for reduced motion preference
137- const prefersReducedMotion = ref (false )
138- onMounted (() => {
139- prefersReducedMotion .value = window .matchMedia (' (prefers-reduced-motion: reduce)' ).matches
140- })
136+ const prefersReducedMotion = useMediaQuery (' (prefers-reduced-motion: reduce)' )
141137 </script >
142138
143139<template >
144140 <div class =" relative" >
145141 <label v-if =" label" :for =" inputId" class =" sr-only" >{{ label }}</label >
146142 <input
147143 :id =" inputId"
148- ref =" inputRef"
149144 v-model =" inputValue"
150145 type =" text"
151146 :placeholder =" placeholder ?? 'username…'"
You can’t perform that action at this time.
0 commit comments