Skip to content

Commit 92b92ae

Browse files
geecubrc-dd
andauthoredOct 12, 2024··
fix(theme): improve local search input a11y (#4066)
Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
1 parent 461a5b0 commit 92b92ae

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
 

‎src/client/theme-default/components/VPLocalSearchBox.vue

+14-3
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,20 @@ function formMarkRegex(terms: Set<string>) {
440440
<input
441441
ref="searchInput"
442442
v-model="filterText"
443-
:placeholder="buttonText"
444-
id="localsearch-input"
443+
:aria-activedescendant="selectedIndex > -1 ? ('localsearch-item-' + selectedIndex) : undefined"
444+
aria-autocomplete="both"
445+
:aria-controls="results?.length ? 'localsearch-list' : undefined"
445446
aria-labelledby="localsearch-label"
447+
autocapitalize="off"
448+
autocomplete="off"
449+
autocorrect="off"
446450
class="search-input"
451+
id="localsearch-input"
452+
enterkeyhint="go"
453+
maxlength="64"
454+
:placeholder="buttonText"
455+
spellcheck="false"
456+
type="search"
447457
/>
448458
<div class="search-actions">
449459
<button
@@ -482,8 +492,9 @@ function formMarkRegex(terms: Set<string>) {
482492
<li
483493
v-for="(p, index) in results"
484494
:key="p.id"
485-
role="option"
495+
:id="'localsearch-item-' + index"
486496
:aria-selected="selectedIndex === index ? 'true' : 'false'"
497+
role="option"
487498
>
488499
<a
489500
:href="p.id"

0 commit comments

Comments
 (0)
Please sign in to comment.