From 662fb282c176ca00a85b6dec7af90446ea90f662 Mon Sep 17 00:00:00 2001 From: Marcy Sutton Date: Wed, 14 Oct 2015 14:04:46 -0700 Subject: [PATCH] fix(ngAria): don't add tabindex to radio and checkbox inputs Closes #12492 Closes #13095 --- src/ngAria/aria.js | 3 ++- test/ngAria/ariaSpec.js | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ngAria/aria.js b/src/ngAria/aria.js index 32ae204633b9..036dd42b47de 100644 --- a/src/ngAria/aria.js +++ b/src/ngAria/aria.js @@ -235,7 +235,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) { } }, post: function(scope, elem, attr, ngModel) { - var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem); + var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem) + && !isNodeOneOf(elem, nodeBlackList); function ngAriaWatchModelValue() { return ngModel.$modelValue; diff --git a/test/ngAria/ariaSpec.js b/test/ngAria/ariaSpec.js index 911e6aab73d5..73b015f710c3 100644 --- a/test/ngAria/ariaSpec.js +++ b/test/ngAria/ariaSpec.js @@ -616,16 +616,18 @@ describe('$aria', function() { describe('tabindex', function() { beforeEach(injectScopeAndCompiler); - it('should not attach to native controls', function() { - var element = [ - $compile("")(scope), - $compile("")(scope), - $compile("")(scope), - $compile("")(scope), - $compile("")(scope), - $compile("
")(scope) - ]; - expectAriaAttrOnEachElement(element, 'tabindex', undefined); + they('should not attach to native control $prop', { + 'button': "", + 'a': "
", + 'input[text]': "", + 'input[radio]': "", + 'input[checkbox]': "", + 'textarea': "", + 'select': "", + 'details': "
" + }, function(html) { + compileElement(html); + expect(element.attr('tabindex')).toBeUndefined(); }); it('should not attach to random ng-model elements', function() {