Skip to content

Commit 88c12a7

Browse files
authored
Merge pull request #242 from eserkansozer/241-Accessibility-Missing_required_WAI-ARIA_states_or_properties
Issue#241- Aria-controls added to input
2 parents a03813e + c30da7b commit 88c12a7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/typeahead/input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var Input = (function() {
3636
this.$input = $(o.input);
3737
this.$menu = $(o.menu);
3838

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

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

4848
this.$input.attr({
4949
'aria-owns': id + '_listbox',
50+
'aria-controls': id + '_listbox',
5051
role: 'combobox',
5152
'aria-autocomplete': 'list',
5253
'aria-expanded': false

test/typeahead/input_spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ describe('Input', function() {
3232
function noInput() { new Input({}, www); }
3333
});
3434

35+
it('should have an aria-controls attribute', function() {
36+
expect(this.$input.attr("aria-controls")).toBeDefined();
37+
});
38+
3539
describe('when the blur DOM event is triggered', function() {
3640
it('should reset the input value', function() {
3741
this.view.setQuery('wine');

0 commit comments

Comments
 (0)