Skip to content

Commit 9fbf2e6

Browse files
authored
Merge pull request #94 from brunoprietog/custom-results-aria-label
Allow to customize the aria-label attribute of the results container
2 parents ab9a7ba + 0f51cdb commit 9fbf2e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/autocomplete.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ export default class Autocomplete {
5454
}
5555

5656
this.results.hidden = true
57+
5758
// @jscholes recommends a generic "results" label as the results are already related to the combobox, which is properly labelled
58-
this.results.setAttribute('aria-label', 'results')
59+
if (!this.results.getAttribute('aria-label')) {
60+
this.results.setAttribute('aria-label', 'results')
61+
}
62+
5963
this.input.setAttribute('autocomplete', 'off')
6064
this.input.setAttribute('spellcheck', 'false')
6165

0 commit comments

Comments
 (0)