@@ -80,8 +80,13 @@ Layout.render
8080 <% if Option.is_some search_index_digest then (%>
8181 <input id="in-package-search-input" type="search" name="q" class="min-w-0 focus:border-gray-800 text-gray-800 border-primary-600 h-10 rounded-l-md appearance-none px-4 flex-grow"
8282 autocomplete="off"
83+ aria-owns="#in-package-search-results"
84+ aria-expanded="false"
85+ aria-autocomplete="list"
86+ aria-describedby="#search-instructions"
8387 placeholder="Search names in this package..."
84- onfocus="this.select()"
88+ onfocus="this.select(); this.setAttribute('aria-expanded', true)"
89+ onblur="this.setAttribute('aria-expanded', false)"
8590 >
8691 <div aria-hidden="true" class="h-10 rounded-r-md bg-primary-600 text-white flex items-center justify-center px-4">
8792 <%s! Icons.magnifying_glass "w-6 h-6" %>
@@ -92,7 +97,7 @@ Layout.render
9297 <% ); %>
9398 </div>
9499
95- <div x-show="search_instructions" class="absolute top-12 p-4 right-0 left-0 bg-white z-[22] w-full max-h-[60vh] overflow-y-auto border rounded-lg shadow-xl">
100+ <div id="search-instructions" x-show="search_instructions" class="absolute top-12 p-4 right-0 left-0 bg-white z-[22] w-full max-h-[60vh] overflow-y-auto border rounded-lg shadow-xl">
96101 <%s! search_instructions_html () %>
97102 </div>
98103
@@ -297,6 +302,7 @@ Layout.render
297302
298303 if (search_results_position !== null) document.getElementById("search-result-"+results[search_results_position].id).classList.remove("active");
299304 adjust_position(event);
305+ document.getElementById("in-package-search-input").setAttribute("aria-activedescendant", search_results_position === null ? null : "search-result-"+results[search_results_position].id);
300306 if (search_results_position !== null) {
301307 let el = document.getElementById("search-result-"+results[search_results_position].id);
302308 el.classList.add("active");
0 commit comments