@@ -20,6 +20,7 @@ const isSearchExpandedManually = shallowRef(false)
2020const searchBoxRef = shallowRef <{ focus: () => void } | null >(null )
2121
2222// On search page, always show search expanded on mobile
23+ const isOnHomePage = computed (() => route .name === ' index' )
2324const isOnSearchPage = computed (() => route .name === ' search' )
2425const isSearchExpanded = computed (() => isOnSearchPage .value || isSearchExpandedManually .value )
2526
@@ -72,17 +73,36 @@ onKeyStroke(
7273 },
7374 { dedupe: true },
7475)
76+
77+ onKeyStroke (
78+ ' c' ,
79+ e => {
80+ // Allow more specific handlers to take precedence
81+ if (e .defaultPrevented ) return
82+
83+ // Don't trigger if user is typing in an input
84+ const target = e .target as HTMLElement
85+ if (target .tagName === ' INPUT' || target .tagName === ' TEXTAREA' || target .isContentEditable ) {
86+ return
87+ }
88+
89+ e .preventDefault ()
90+ navigateTo (' /compare' )
91+ },
92+ { dedupe: true },
93+ )
7594 </script >
7695
7796<template >
7897 <header class =" sticky top-0 z-50 bg-bg/80 backdrop-blur-md border-b border-border" >
7998 <nav
8099 :aria-label =" $t('nav.main_navigation')"
81- class =" container min-h-14 flex items-center justify-between gap-2"
100+ class =" container min-h-14 flex items-center gap-2"
101+ :class =" isOnHomePage ? 'justify-end' : 'justify-between'"
82102 >
83103 <!-- Mobile: Logo + search button (expands search, doesn't navigate) -->
84104 <button
85- v-if =" !isSearchExpanded"
105+ v-if =" !isSearchExpanded && !isOnHomePage "
86106 type =" button"
87107 class =" sm:hidden flex-shrink-0 inline-flex items-center gap-2 font-mono text-lg font-medium text-fg hover:text-fg transition-colors duration-200 focus-ring rounded"
88108 :aria-label =" $t('nav.tap_to_search')"
@@ -156,10 +176,16 @@ onKeyStroke(
156176 <!-- Desktop: Compare link -->
157177 <NuxtLink
158178 to =" /compare"
159- class =" hidden sm:inline-flex link-subtle font-mono text-sm items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 rounded"
179+ class =" hidden sm:inline-flex link-subtle font-mono text-sm items-center gap-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 rounded"
180+ aria-keyshortcuts =" c"
160181 >
161- <span class =" i-carbon:compare w-4 h-4" aria-hidden =" true" />
162182 {{ $t('nav.compare') }}
183+ <kbd
184+ class =" inline-flex items-center justify-center w-5 h-5 text-xs bg-bg-muted border border-border rounded"
185+ aria-hidden =" true"
186+ >
187+ c
188+ </kbd >
163189 </NuxtLink >
164190
165191 <!-- Desktop: Settings link -->
@@ -185,7 +211,7 @@ onKeyStroke(
185211 <!-- Mobile: Menu button (always visible, toggles menu) -->
186212 <button
187213 type =" button"
188- class =" sm:hidden p-2 -m-2 text-fg-subtle hover:text-fg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 rounded"
214+ class =" sm:hidden flex items-center p-2 -m-2 text-fg-subtle hover:text-fg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 rounded"
189215 :aria-label =" showMobileMenu ? $t('common.close') : $t('nav.open_menu')"
190216 :aria-expanded =" showMobileMenu"
191217 @click =" showMobileMenu = !showMobileMenu"
0 commit comments