Skip to content

Commit

Permalink
fix(ngAria): remove tabindex from radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
marcysutton committed Oct 22, 2015
1 parent 9f716dd commit 1959850
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
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
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 with ng-model', {
'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 1959850

Please sign in to comment.