Feat: Live search accessibility, no-results message and View all styling

This commit is contained in:
elvira committed 2026-10-23 20:59:23 +03:00
1 parent d1d27a9ebd
commit 9217960de0
4 files changed
+118 -33

No files matched your search

@@ -9,7 +9,11 @@
Live search: from 3 characters, the `nav-search` controller points the
<turbo-frame id="search-suggestions"> under the bar at the same /search
endpoint, which answers that frame with the first few matches
(search/suggestions.blade.php). Enter still goes to the full results page.
(search/suggestions.blade.php). Enter still goes to the full results page,
unless a suggestion is highlighted with the arrow keys.
ARIA: the input is a combobox for the suggestions listbox; the role="status"
region below announces the result count after each load.
--}}
<div
id="search-overlay"
@@ -24,15 +28,19 @@ class="fixed w-full inset-x-0 top-0 bottom-auto m-0 border-0 bg-transparent p-0"
data-nav-search-target="form"
class="flex h-[var(--search-overlay-h)] items-center gap-6 bg-brand px-10"
>
<label for="search-overlay-input" class="sr-only">{{ __('storefront.shop.search_label') }}</label>
<label id="search-overlay-label" for="search-overlay-input" class="sr-only">{{ __('storefront.shop.search_label') }}</label>
<input
id="search-overlay-input"
type="search"
name="q"
required
autocomplete="off"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="search-suggestions-list"
data-nav-search-target="input"
data-action="input->nav-search#suggest"
data-action="input->nav-search#suggest keydown->nav-search#navigate"
placeholder="{{ __('storefront.search.placeholder') }}"
class="min-w-0 flex-1 appearance-none border-0 border-b border-black bg-transparent pb-2 placeholder:text-black/60 focus:outline-none [&::-webkit-search-cancel-button]:appearance-none"
>
@@ -47,5 +55,7 @@ class="shrink-0 text-black transition-opacity hover:opacity-70"
</button>
</form>
<p role="status" class="sr-only" data-nav-search-target="status"></p>
<turbo-frame id="search-suggestions" data-nav-search-target="results"></turbo-frame>
</div>