Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/components/Header/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ defineExpose({ focus })

<div class="relative group" :class="{ 'is-focused': isSearchFocused }">
<div class="search-box relative flex items-center">
<span
class="absolute inset-is-3 text-fg-subtle font-mono text-sm pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1"
<kbd
class="absolute inset-is-3 text-fg-subtle font-mono text-sm pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1 rounded"
aria-hidden="true"
>
/
</span>
</kbd>

<InputBase
id="header-search"
Expand All @@ -56,6 +57,7 @@ defineExpose({ focus })
@focus="isSearchFocused = true"
@blur="isSearchFocused = false"
size="small"
ariaKeyshortcuts="/"
/>
<button type="submit" class="sr-only">{{ $t('search.button') }}</button>
</div>
Expand Down
5 changes: 5 additions & 0 deletions app/components/Input/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const props = withDefaults(
* @default true
*/
noCorrect?: boolean
/** Keyboard shortcut hint */
ariaKeyshortcuts?: string
}>(),
{
size: 'medium',
Expand All @@ -28,6 +30,8 @@ const emit = defineEmits<{

const el = useTemplateRef('el')

const keyboardShortcutsEnabled = useKeyboardShortcuts()

defineExpose({
focus: () => el.value?.focus(),
blur: () => el.value?.blur(),
Expand All @@ -51,5 +55,6 @@ defineExpose({
/** Catching Vue render-bug of invalid `disabled=false` attribute in the final HTML */
disabled ? true : undefined
"
:aria-keyshortcuts="keyboardShortcutsEnabled ? ariaKeyshortcuts : undefined"
/>
</template>
8 changes: 5 additions & 3 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ defineOgImageComponent('Default', {
/>

<div class="search-box relative flex items-center">
<span
class="absolute inset-is-4 text-fg-subtle font-mono text-lg pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1"
<kbd
class="absolute inset-is-4 text-fg-subtle font-mono text-lg pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1 rounded"
aria-hidden="true"
>
/
</span>
</kbd>

<InputBase
id="home-search"
Expand All @@ -87,6 +88,7 @@ defineOgImageComponent('Default', {
class="w-full ps-8 pe-24"
@focus="isSearchFocused = true"
@blur="isSearchFocused = false"
ariaKeyshortcuts="/"
/>

<ButtonBase
Expand Down
Loading