Skip to content

Commit

Permalink
Add aria-controls attribute to input element (#17257)
Browse files Browse the repository at this point in the history
Currently using aria-owns attribute to relate input and listbox, per ARIA 1.0. Added use of aria-controls, per ARIA 1.1. Left aria-owns in place for B/C and also makes sense as list is a sibling of input anyway.
  • Loading branch information
weeblr authored Jul 24, 2024
1 parent 3c7ee84 commit 04f0f6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion awesomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var _ = function (input, o) {
this.input.setAttribute("autocomplete", "off");
this.input.setAttribute("aria-autocomplete", "list");
this.input.setAttribute("aria-expanded", "false");
this.input.setAttribute("aria-controls", "awesomplete_list_" + this.count);
this.input.setAttribute("aria-owns", "awesomplete_list_" + this.count);
this.input.setAttribute("role", "combobox");

Expand Down Expand Up @@ -230,7 +231,8 @@ _.prototype = {
this.input.removeAttribute("autocomplete");
this.input.removeAttribute("aria-autocomplete");
this.input.removeAttribute("aria-expanded");
this.input.removeAttribute("aria-owns");
this.input.removeAttribute("aria-controls");
this.input.removeAttribute("aria-owns");
this.input.removeAttribute("role");

//remove this awesomeplete instance from the global array of instances
Expand Down

0 comments on commit 04f0f6e

Please sign in to comment.