From 6a0ea9ebe5ed8cf8cb0481e1230bf43d1bb5e294 Mon Sep 17 00:00:00 2001 From: Marcy Sutton Date: Wed, 14 Oct 2015 14:04:46 -0700 Subject: [PATCH] fix(ngAria): remove tabindex from radio buttons Closes #12492 --- src/ngAria/aria.js | 3 ++- test/ngAria/ariaSpec.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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..b9f122b4e84d 100644 --- a/test/ngAria/ariaSpec.js +++ b/test/ngAria/ariaSpec.js @@ -628,6 +628,13 @@ describe('$aria', function() { expectAriaAttrOnEachElement(element, 'tabindex', undefined); }); + it('should not attach to native controls via ngmodel', function() { + scope.$apply('val = null'); + compileElement(''); + + expect(element.attr('tabindex')).toBeUndefined(); + }); + it('should not attach to random ng-model elements', function() { compileElement('
'); expect(element.attr('tabindex')).toBeUndefined();