diff --git a/lib/__tests__/index-test.js b/lib/__tests__/index-test.js index 4c684ef..de14b21 100644 --- a/lib/__tests__/index-test.js +++ b/lib/__tests__/index-test.js @@ -98,7 +98,7 @@ describe('props', () => { }); describe('when role="button"', () => { - it('requires onKeyUp', () => { + it('requires onKeyDown', () => { expectWarning(assertions.props.onClick.BUTTON_ROLE_SPACE.msg, () => { ; }); diff --git a/lib/assertions.js b/lib/assertions.js index 3adede5..9d75695 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -68,8 +68,6 @@ exports.props = { } }, - // onKeyUp is too late to cancel space's default behavior of scrolling the - // page. BUTTON_ROLE_SPACE: { msg: 'You have `role="button"` but did not define an `onKeyDown` handler. Add it, and have the "Space" key do the same thing as an `onClick` handler.', test (tagName, props, children) { @@ -80,7 +78,7 @@ exports.props = { BUTTON_ROLE_ENTER: { msg: 'You have `role="button"` but did not define an `onKeyDown` handler. Add it, and have the "Enter" key do the same thing as an `onClick` handler.', test (tagName, props, children) { - return !(props.role === 'button' && props.onKeyDown); + return !(props.role === 'button' && !props.onKeyDown); } }