react-hook-form: Validation gets triggered on blur even the mode was set to 'onChange'

Describe the bug Hi, I just found a bug with the onChange mode. Validation gets triggered on blur even the mode was set to onChange

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/react-hook-form-controller-1wurt
  2. Click on Uncontrolled input textbox (dont type anything)
  3. Remove the focus
  4. Error is shown

Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-controller-1wurt

Expected behavior Error should not be shown if the mode is onChange because the user doesn’t perform any input changes. This should only happen if the mode is onBlur

Desktop (please complete the following information):

  • OS: Mac OS Mojave
  • Browser: chrome
  • Version: 80.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

5.1.2-beta.1 here you go.

no, not really. i will have to release a beta version for this.

I will re-open this issue so i remind myself to publish a beta version.

onChange should only trigger validation onChange, this is a bug which i will fix for native input.

Actually, I think this behaviour is expected. If the mode was set to onChange, it should also trigger the onBlur.

If this is the case, it’s the other way around. The controlled component doesn’t trigger the validation if the the input has been focused and blurred without user input.