@@ -393,12 +393,12 @@ const exactMatchType = computed<'package' | 'org' | 'user' | null>(() => {
393393const suggestionCount = computed (() => validatedSuggestions .value .length )
394394const totalSelectableCount = computed (() => suggestionCount .value + resultCount .value )
395395
396+ const isVisible = (el : HTMLElement ) => el .getClientRects ().length > 0
397+
396398/**
397399 * Get all focusable result elements in DOM order (suggestions first, then packages)
398400 */
399401function getFocusableElements(): HTMLElement [] {
400- const isVisible = (el : HTMLElement ) => el .getClientRects ().length > 0
401-
402402 const suggestions = Array .from (document .querySelectorAll <HTMLElement >(' [data-suggestion-index]' ))
403403 .filter (isVisible )
404404 .sort ((a , b ) => {
@@ -435,7 +435,7 @@ async function navigateToPackage(packageName: string) {
435435const pendingEnterQuery = shallowRef <string | null >(null )
436436
437437// Watch for results to navigate when Enter was pressed before results arrived
438- watch (displayResults , results => {
438+ watch (displayResults , newResults => {
439439 if (! pendingEnterQuery .value ) return
440440
441441 // Check if input is still focused (user hasn't started navigating or clicked elsewhere)
@@ -445,7 +445,7 @@ watch(displayResults, results => {
445445 }
446446
447447 // Navigate if first result matches the query that was entered
448- const firstResult = results [0 ]
448+ const firstResult = newResults [0 ]
449449 // eslint-disable-next-line no-console
450450 console .log (' [search] watcher fired' , {
451451 pending: pendingEnterQuery .value ,
0 commit comments