From eba801bd7db26e0124e8b9811c2852c258f5e529 Mon Sep 17 00:00:00 2001 From: Bruno Prieto Date: Wed, 28 Sep 2022 05:41:23 -0300 Subject: [PATCH 1/2] Allow to customize the aria-label attribute of the results container --- src/autocomplete.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/autocomplete.ts b/src/autocomplete.ts index 6d5a99b..93911a9 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -54,8 +54,12 @@ export default class Autocomplete { } this.results.hidden = true + // @jscholes recommends a generic "results" label as the results are already related to the combobox, which is properly labelled - this.results.setAttribute('aria-label', 'results') + if (!this.results.getAttribute('aria-label')) { + this.results.setAttribute('aria-label', 'results') + } + this.input.setAttribute('autocomplete', 'off') this.input.setAttribute('spellcheck', 'false') From 0f51cdbbf361880546fe5f167e0f8be5041d79bf Mon Sep 17 00:00:00 2001 From: Bruno Prieto Date: Thu, 17 Nov 2022 00:40:38 -0300 Subject: [PATCH 2/2] Lint --- src/autocomplete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autocomplete.ts b/src/autocomplete.ts index 93911a9..2a86cca 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -59,7 +59,7 @@ export default class Autocomplete { if (!this.results.getAttribute('aria-label')) { this.results.setAttribute('aria-label', 'results') } - + this.input.setAttribute('autocomplete', 'off') this.input.setAttribute('spellcheck', 'false')