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
{{ message }}
Repository navigation
Need global feedback on instance form validation error #2345
When you try to make an instance without selecting an image (for example) the form refuses to submit and there is an error on the image field, but if you're scrolled down past the image field, you don't see anything. The form just refuses to submit.
changed the title [-]No global feedback on instance form validation error[/-][+]Need global feedback on instance form validation error[/+]on Jul 29, 2024
While working on #2358 I noticed that our forms scroll to the error when there's a validation error. I think I was so used to that behavior that I hadn't consciously registered that it was happening. The good news is: other fields in this form have the correct scroll-to behavior. For example, if you go here and scroll down and hit submit without entering anything in the fields, it will scroll you to the name field because it's the first one with an error.
This behavior uses the ref on the field returned from useController to do the scrolling. I confirmed this by leaving ref out on NameField (technically TextFieldInner where it actually happens) and the scroll-to behavior stopped happening. So we just need fix the image field in particular, which should be a one-liner once we find the right line. Simply adding ref={field.ref} to the Listbox call here does not do it.
Activity
[-]No global feedback on instance form validation error[/-][+]Need global feedback on instance form validation error[/+]david-crespo commentedon Aug 12, 2024
While working on #2358 I noticed that our forms scroll to the error when there's a validation error. I think I was so used to that behavior that I hadn't consciously registered that it was happening. The good news is: other fields in this form have the correct scroll-to behavior. For example, if you go here and scroll down and hit submit without entering anything in the fields, it will scroll you to the name field because it's the first one with an error.
https://console-h4730wth3-oxidecomputer.vercel.app/projects/mock-project/instances-new
This behavior uses the
refon thefieldreturned fromuseControllerto do the scrolling. I confirmed this by leavingrefout onNameField(technicallyTextFieldInnerwhere it actually happens) and the scroll-to behavior stopped happening. So we just need fix the image field in particular, which should be a one-liner once we find the right line. Simply addingref={field.ref}to the Listbox call here does not do it.console/app/components/form/fields/ListboxField.tsx
Lines 60 to 64 in 8e3314f