Skip to content

Commit

Permalink
Merge pull request #242 from eserkansozer/241-Accessibility-Missing_r…
Browse files Browse the repository at this point in the history
…equired_WAI-ARIA_states_or_properties

Issue#241- Aria-controls added to input
  • Loading branch information
jlbooker authored Sep 3, 2021
2 parents a03813e + c30da7b commit 88c12a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/typeahead/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var Input = (function() {
this.$input = $(o.input);
this.$menu = $(o.menu);

// this id is used for aria-owns
// this id is used for aria-owns and aria-controls
id = this.$input.attr('id') || _.guid();

this.$menu.attr('id', id + '_listbox');
Expand All @@ -47,6 +47,7 @@ var Input = (function() {

this.$input.attr({
'aria-owns': id + '_listbox',
'aria-controls': id + '_listbox',
role: 'combobox',
'aria-autocomplete': 'list',
'aria-expanded': false
Expand Down
4 changes: 4 additions & 0 deletions test/typeahead/input_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ describe('Input', function() {
function noInput() { new Input({}, www); }
});

it('should have an aria-controls attribute', function() {
expect(this.$input.attr("aria-controls")).toBeDefined();
});

describe('when the blur DOM event is triggered', function() {
it('should reset the input value', function() {
this.view.setQuery('wine');
Expand Down

0 comments on commit 88c12a7

Please sign in to comment.