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

Commit

Permalink
fix(ngAria): don't add tabindex to radio and checkbox inputs
Browse files Browse the repository at this point in the history
Closes #12492
Closes #13095
  • Loading branch information
marcysutton authored and Narretz committed Oct 27, 2015
1 parent ffb6b2f commit 662fb28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/ngAria/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 12 additions & 10 deletions test/ngAria/ariaSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,18 @@ describe('$aria', function() {
describe('tabindex', function() {
beforeEach(injectScopeAndCompiler);

it('should not attach to native controls', function() {
var element = [
$compile("<button ng-click='something'></button>")(scope),
$compile("<a ng-href='#/something'>")(scope),
$compile("<input ng-model='val'>")(scope),
$compile("<textarea ng-model='val'></textarea>")(scope),
$compile("<select ng-model='val'></select>")(scope),
$compile("<details ng-model='val'></details>")(scope)
];
expectAriaAttrOnEachElement(element, 'tabindex', undefined);
they('should not attach to native control $prop', {
'button': "<button ng-click='something'></button>",
'a': "<a ng-href='#/something'>",
'input[text]': "<input type='text' ng-model='val'>",
'input[radio]': "<input type='radio' ng-model='val'>",
'input[checkbox]': "<input type='checkbox' ng-model='val'>",
'textarea': "<textarea ng-model='val'></textarea>",
'select': "<select ng-model='val'></select>",
'details': "<details ng-model='val'></details>"
}, function(html) {
compileElement(html);
expect(element.attr('tabindex')).toBeUndefined();
});

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

0 comments on commit 662fb28

Please sign in to comment.