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

Commit 662fb28

Browse files
marcysuttonNarretz
authored andcommitted
fix(ngAria): don't add tabindex to radio and checkbox inputs
Closes #12492 Closes #13095
1 parent ffb6b2f commit 662fb28

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/ngAria/aria.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
235235
}
236236
},
237237
post: function(scope, elem, attr, ngModel) {
238-
var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem);
238+
var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem)
239+
&& !isNodeOneOf(elem, nodeBlackList);
239240

240241
function ngAriaWatchModelValue() {
241242
return ngModel.$modelValue;

test/ngAria/ariaSpec.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -616,16 +616,18 @@ describe('$aria', function() {
616616
describe('tabindex', function() {
617617
beforeEach(injectScopeAndCompiler);
618618

619-
it('should not attach to native controls', function() {
620-
var element = [
621-
$compile("<button ng-click='something'></button>")(scope),
622-
$compile("<a ng-href='#/something'>")(scope),
623-
$compile("<input ng-model='val'>")(scope),
624-
$compile("<textarea ng-model='val'></textarea>")(scope),
625-
$compile("<select ng-model='val'></select>")(scope),
626-
$compile("<details ng-model='val'></details>")(scope)
627-
];
628-
expectAriaAttrOnEachElement(element, 'tabindex', undefined);
619+
they('should not attach to native control $prop', {
620+
'button': "<button ng-click='something'></button>",
621+
'a': "<a ng-href='#/something'>",
622+
'input[text]': "<input type='text' ng-model='val'>",
623+
'input[radio]': "<input type='radio' ng-model='val'>",
624+
'input[checkbox]': "<input type='checkbox' ng-model='val'>",
625+
'textarea': "<textarea ng-model='val'></textarea>",
626+
'select': "<select ng-model='val'></select>",
627+
'details': "<details ng-model='val'></details>"
628+
}, function(html) {
629+
compileElement(html);
630+
expect(element.attr('tabindex')).toBeUndefined();
629631
});
630632

631633
it('should not attach to random ng-model elements', function() {

0 commit comments

Comments
 (0)