From 72bad32ae4d48049e52602a4feda8eef9fbe6f0c Mon Sep 17 00:00:00 2001 From: marcysutton Date: Mon, 27 Oct 2014 11:53:57 -0400 Subject: [PATCH] fix(md-input-group): Disable with ARIA --- src/components/textField/textField.js | 1 + src/components/textField/textField.spec.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/textField/textField.js b/src/components/textField/textField.js index 007f68c0fc1..79136bb00c1 100644 --- a/src/components/textField/textField.js +++ b/src/components/textField/textField.js @@ -148,6 +148,7 @@ function mdInputDirective($mdUtil) { var isDisabled = $mdUtil.isParentDisabled(element); element.attr('tabindex', isDisabled ? -1 : 0 ); + element.attr('aria-disabled', isDisabled ? 'true' : 'false'); element.attr('type', attr.type || element.parent().attr('type') || "text" ); // When the input value changes, check if it "has" a value, and diff --git a/src/components/textField/textField.spec.js b/src/components/textField/textField.spec.js index 0a184b9102c..892cad848b2 100644 --- a/src/components/textField/textField.spec.js +++ b/src/components/textField/textField.spec.js @@ -12,7 +12,7 @@ describe('Text Field directives', function() { email: 'ThomasBurleson@gmail.com', password: 'your password is incorrect' } - } + }; }); it('should set input class for focus & blur', function() { @@ -200,6 +200,7 @@ describe('Text Field directives', function() { expect( label.attr('for') ).toBe( "093" ); expect( input.attr('id') ).toBe( label.attr('for') ); }); + it('should auto-pair input and label for accessibility.', function() { var markup =''; var el = buildElement( markup, model); var input = el.find('input'); - var label = el.find('label') + var label = el.find('label'); expect( label.attr('for') == "" ).toBe( false ); expect( input.attr('id') ).toBe( label.attr('for') ); }); + it('should add an ARIA attribute for disabled inputs', function() { + var markup ='' + + ''; + var el = buildElement( markup, model); + var input = el.find('input'); + + expect( input.attr('aria-disabled') ).toBe( 'true' ); + }); }); // ****************************************************************