You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I'm setting shouldValidate to onBlur, because control.blur is invoked when the select is closed, validation should be triggered and error message should hide, it does not work as expected.
I did some initial investigation. Below are some notes with my findings.
The useControl hook uses the useInputEvent hook internally, which adds a focusout event listener to manage its internal state for the blur event logic.
Conform will focus the first invalid field when the form is submitted. Since the native select element is focused on submission, the aforementioned focusout event listener will be triggered after another element gains focus, either programmatically via focus delegation of the custom control or if a user interacts with the page.
If you add a second select field to the form, the issue is only replicable for the first field since only the first field is focused on submission after being invalidated.
Describe the bug and the expected behavior
I'm setting up a shadcn select, like this:
https://github.com/juanpmarin/conform-issue-repro/blob/b3324dbcddfa201b4f1165b7aeb95cfd980cf2be/components/buggy-form.tsx#L57-L114
And I'm setting
shouldValidate
toonBlur
, becausecontrol.blur
is invoked when the select is closed, validation should be triggered and error message should hide, it does not work as expected.Conform version
v1.2.2
Steps to Reproduce the Bug or Issue
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: