Skip to content

Commit

Permalink
Merge pull request #502 from /issues/501@v2
Browse files Browse the repository at this point in the history
dom: Wrong result of isFocusable() for link without href but with tabindex attribute
  • Loading branch information
Vladimir Varankin committed Apr 17, 2014
2 parents c03a8de + 0cb2c43 commit ac36c3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common.blocks/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ provide(/** @exports */{
var domNode = domElem[0];

if(!domNode) return false;
if(domNode.hasAttribute('tabindex')) return true;

switch(domNode.tagName.toLowerCase()) {
case 'iframe':
Expand All @@ -67,10 +68,9 @@ provide(/** @exports */{

case 'a':
return !!domNode.href;

default:
return domNode.hasAttribute('tabindex');
}

return false;
},

/**
Expand All @@ -97,4 +97,4 @@ provide(/** @exports */{
}
});

});
});
1 change: 1 addition & 0 deletions common.blocks/dom/dom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('dom', function() {

it('should returns true if given DOM elem has tabindex', function() {
dom.isFocusable($('<span tabindex="4"/>')).should.be.true;
dom.isFocusable($('<a tabindex="5"/>')).should.be.true;
dom.isFocusable($('<span/>')).should.be.false;
});

Expand Down

0 comments on commit ac36c3e

Please sign in to comment.