diff --git a/src/rules/use-onblur-not-onchange.js b/src/rules/use-onblur-not-onchange.js index 61e1534..2d92854 100644 --- a/src/rules/use-onblur-not-onchange.js +++ b/src/rules/use-onblur-not-onchange.js @@ -19,8 +19,9 @@ export default [{ const disabled = trueish(props, 'aria-disabled'); const readOnly = trueish(props, 'aria-readonly'); const onChange = listensTo(props, 'onChange'); + const onBlur = listensTo(props, 'onBlur'); - return hidden || disabled || readOnly || !onChange; + return hidden || disabled || readOnly || !onChange || (onChange && onBlur); } }]; @@ -37,10 +38,13 @@ export const pass = [{ }, { when: 'the element is aria-readonly', render: React => +}, { + when: 'the `onChange` prop is present along with an `onBlur` prop', + render: React => }]; export const fail = [{ - when: 'the `onChange` prop is present', + when: 'the `onChange` prop is present without an `onBlur` prop', render: React => }];