-
Notifications
You must be signed in to change notification settings - Fork 1
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
validate on input with debounce #12
base: main
Are you sure you want to change the base?
Conversation
98e236e
to
80f31ab
Compare
Hold on. Example: https://youtu.be/lMOLrdqilqE?si=JwKzNQHuTK9cLmpL&t=335 |
ok we could remove the debounce time if it is needed, but the point is that on standard text input, validation is fired only on change listener, this means that it fires only when the element loses focus: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event |
For example, in |
In the case of Keycloakify, it depends. Some fields are validated immediately upon change, as the user type, while others are only validated after focus was lost once then they are validated in realtime. The way I designed the API is to abstract away those details. The user is responsible for dispatching both the "focus lost" and "change" events—everything else is handled internally (like what errors should be displayed on what field and what is the current value of the inputs). If you believe the default behavior should be adjusted, I'm open to hearing your arguments. However, this change should be made within Keycloakify itself, not in Let me know if your suggestion is motivated by performance considerations, UX improvements, or if something isn't working as expected. Is the behavior you're trying to address observable in Keycloakify for React? I'm looking forward to your thoughts. |
I think this is a misunderstanding. It is now impossible to validate an input when the user is typing. There is only a listener on the change event and it is only fired when the focus is lost. There is no need to change anything in the lib because it is an html event listener callback, but the code inside is the same (it must send an update event). |
80f31ab
to
947127d
Compare
additional validation on typing for text inputs. It has a debounce of 300ms