Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 72bad32

Browse files
marcysuttonMarcy Sutton
authored andcommitted
fix(md-input-group): Disable with ARIA
1 parent d46f74a commit 72bad32

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/components/textField/textField.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ function mdInputDirective($mdUtil) {
148148
var isDisabled = $mdUtil.isParentDisabled(element);
149149

150150
element.attr('tabindex', isDisabled ? -1 : 0 );
151+
element.attr('aria-disabled', isDisabled ? 'true' : 'false');
151152
element.attr('type', attr.type || element.parent().attr('type') || "text" );
152153

153154
// When the input value changes, check if it "has" a value, and

src/components/textField/textField.spec.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Text Field directives', function() {
1212
email: 'ThomasBurleson@gmail.com',
1313
password: 'your password is incorrect'
1414
}
15-
}
15+
};
1616
});
1717

1818
it('should set input class for focus & blur', function() {
@@ -200,19 +200,30 @@ describe('Text Field directives', function() {
200200
expect( label.attr('for') ).toBe( "093" );
201201
expect( input.attr('id') ).toBe( label.attr('for') );
202202
});
203+
203204
it('should auto-pair input and label for accessibility.', function() {
204205
var markup ='<md-text-float ' +
205206
' label="{{labels.firstName}}" ' +
206207
' ng-model="user.firstName" >' +
207208
'</md-text-float>';
208209
var el = buildElement( markup, model);
209210
var input = el.find('input');
210-
var label = el.find('label')
211+
var label = el.find('label');
211212

212213
expect( label.attr('for') == "" ).toBe( false );
213214
expect( input.attr('id') ).toBe( label.attr('for') );
214215
});
215216

217+
it('should add an ARIA attribute for disabled inputs', function() {
218+
var markup ='<md-text-float disabled ' +
219+
' label="{{labels.firstName}}" ' +
220+
' ng-model="user.firstName" >' +
221+
'</md-text-float>';
222+
var el = buildElement( markup, model);
223+
var input = el.find('input');
224+
225+
expect( input.attr('aria-disabled') ).toBe( 'true' );
226+
});
216227
});
217228

218229
// ****************************************************************

0 commit comments

Comments
 (0)