Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revalidate() on an inputHandler ignores focusInvalidField config on Chrome #58

Closed
daymoz opened this issue Apr 14, 2022 · 2 comments
Closed

Comments

@daymoz
Copy link

daymoz commented Apr 14, 2022

Describe the bug
I have to revalidate form after input change on my form to enable or disable submit button. My global config has "focusInvalidField" set to false. Works perfectrly fine on Mozilla. On the last version of Chrome, whenever I type in my input, focus is lost.

To Reproduce
On Chrome

  1. Having set Just Validate config properly
    Capture d’écran du 2022-04-14 12-08-08
  2. Having input handler on my fields
    Capture d’écran du 2022-04-14 12-08-45
  3. Using revalidate() to enable or disable submit button
    Capture d’écran du 2022-04-14 12-09-15

Expected behavior
Should not lose focus on the input i'm typing in whenever "focusInvalidField" is set to false

@daymoz
Copy link
Author

daymoz commented Apr 14, 2022

Setting lockForm to false makes it work, weirdly.

@horprogs
Copy link
Owner

Hi, I looked into this. Actually this is not related to focusInvalidField config. The reason why this happens is when revalidate() method called and lockForm: true - each element gets disabled attribute during the validation (this is useful for async validations). That's why browsers could reset the focus.

To avoid this it makes sense to set lockForm: false, as you mentioned. And this is logical, because you don't need to lock the form actually if you do extra actions on inputs.

I will think to add some setting to enable/disable a submit button and a callback if the fields changed to avoid adding extra listeners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants