Skip to content

Commit 870237a

Browse files
committed
Merge pull request #22 from courseload/fix-tabindex-0
Ensure elements with a tabIndex is set to 0 are considered interactive.
2 parents 069ab87 + f33cb44 commit 870237a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/__tests__/index-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ describe('props', () => {
137137
<div onClick={k} tabIndex="0"/>;
138138
});
139139
});
140+
141+
it('does not warn when tabIndex is present', () => {
142+
doNotExpectWarning(assertions.props.onClick.NO_TABINDEX.msg, () => {
143+
<div onClick={k} tabIndex={0}/>;
144+
});
145+
});
140146
});
141147

142148
describe('when element is interactive', () => {

lib/assertions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports.props = {
5151
test (tagName, props, children) {
5252
return !(
5353
!isInteractive(tagName, props) &&
54-
!props.tabIndex
54+
props.tabIndex == null // tabIndex={0} is valid
5555
);
5656
}
5757
},

0 commit comments

Comments
 (0)