3838 placeholder =" Search documentation..."
3939 class =" flex-1 bg-transparent text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 border-0 focus:ring-0 focus:outline-none text-lg"
4040 @input =" performSearch"
41+ @keyup =" performSearch"
4142 @keydown.down.prevent =" navigateResults('down')"
4243 @keydown.up.prevent =" navigateResults('up')"
4344 @keydown.enter.prevent =" selectResult"
45+ autocomplete =" off"
46+ autocorrect =" off"
47+ autocapitalize =" off"
48+ spellcheck =" false"
4449 />
4550
4651 <div class =" hidden sm:flex items-center space-x-2 text-xs text-gray-400 dark:text-gray-500" >
@@ -225,7 +230,10 @@ const debounce = (fn: Function, delay: number) => {
225230
226231// Search functionality
227232const performSearch = debounce (async () => {
228- if (! searchQuery .value .trim ()) {
233+ const query = searchQuery .value ?.trim ()
234+ console .log (' 🔍 Search triggered with query:' , query )
235+
236+ if (! query ) {
229237 searchResults .value = []
230238 return
231239 }
@@ -234,7 +242,10 @@ const performSearch = debounce(async () => {
234242 selectedIndex .value = 0
235243
236244 try {
237- searchResults .value = await searchContent (searchQuery .value )
245+ console .log (' 🔍 Performing search for:' , query )
246+ const results = await searchContent (query )
247+ console .log (' 🔍 Search results:' , results .length , ' items' )
248+ searchResults .value = results
238249 } catch (error ) {
239250 console .error (' Search error:' , error )
240251 searchResults .value = []
@@ -243,6 +254,25 @@ const performSearch = debounce(async () => {
243254 }
244255}, 300 )
245256
257+ // Also create immediate search for iOS
258+ const performImmediateSearch = async () => {
259+ const query = searchQuery .value ?.trim ()
260+ if (! query ) return
261+
262+ console .log (' 🔍 Immediate search for iOS:' , query )
263+ isSearching .value = true
264+
265+ try {
266+ const results = await searchContent (query )
267+ searchResults .value = results
268+ } catch (error ) {
269+ console .error (' Immediate search error:' , error )
270+ searchResults .value = []
271+ } finally {
272+ isSearching .value = false
273+ }
274+ }
275+
246276// Lifecycle
247277onMounted (() => {
248278 document .addEventListener (' keydown' , handleKeydown )
@@ -265,6 +295,14 @@ watch(isOpen, (newIsOpen) => {
265295 }
266296})
267297
298+ // Watch searchQuery changes for iOS devices where input events might not fire
299+ watch (searchQuery , (newQuery ) => {
300+ console .log (' 🔍 Search query changed to:' , newQuery )
301+ if (newQuery !== undefined ) {
302+ performSearch ()
303+ }
304+ }, { immediate: false })
305+
268306// No need to expose methods since we're using global state
269307 </script >
270308
0 commit comments