-
Notifications
You must be signed in to change notification settings - Fork 361
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
fix: [M3-7170] - Create VPC Region and Label Validation #9750
fix: [M3-7170] - Create VPC Region and Label Validation #9750
Conversation
…scription on VPC Create flow do not incorrectly persist
I am finding this to be more disruptive than I initially thought it would be. I take it there's no way for us to revalidate the fields without also triggering the scroll functionality? There doesn't seem to be a lot of context for this ticket -- I notice that the behavior we're implementing here is not consistent with other create forms in Cloud (for example, if you trigger an error in the Linode Create flow, the inline error messages persist until clicking the "Create Linode" button again). Given the jumping behavior, and the fact that this is not a pattern used elsewhere in the app (to my knowledge), is there any chance we might want to revisit this from a design perspective to ensure that this is really the right approach? Edit: Oh, just saw M3-6894 😅 Please disregard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrollErrorIntoView()
takes optional arguments, so you could do
scrollErrorIntoView(undefined, { behavior: 'smooth' });
on L190 of VPCCreate.tsx
to avoid a jarring jump
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
Thanks for pointing that out, @dwiley-akamai! It looks a lot smoother now: Screen.Recording.2023-10-04.at.1.48.56.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it expected behavior for the page to continue to scroll after the first initial scroll?
Screen.Recording.2023-10-04.at.4.11.34.PM.mov
I am experiencing the same issue. |
thanks @hana-linode and @tyler-akamai! Confirmed with Andrew that we should try to get rid of that second scroll, looking into it :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @coliu-akamai! Confirming that scrolling no longer continues after resolving the first error
@@ -151,6 +151,10 @@ const VPCCreate = () => { | |||
visualToAPISubnetMapping | |||
); | |||
setFieldValue('subnets', subnetsAndErrors); | |||
|
|||
if (errors || generalAPIError || generalSubnetErrorsFromAPI) { | |||
scrollErrorIntoView(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the { behavior: 'smooth' } tag from commit 95f64ca since we're no longer scrolling to an error after the initial error (+ looking through the codebase, nothing else has this tag)
@@ -185,11 +189,13 @@ const VPCCreate = () => { | |||
validationSchema: createVPCSchema, | |||
}); | |||
|
|||
React.useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the scrolling logic into the try-catch block of onCreateVPC and got rid of the useEffect in order to prevent rescrolling after initial scroll. (Note that a lot of other flows have this logic in a useEffect, so there might be potential rescrolling behavior there too!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and reintroduced the useEffect with the conditional logic for all three types of errors. If I removed the values from the dependency array, I didnt experience any of the page scrolling behavior. Just an FYI. I found your final solution much cleaner and don't recommend any further changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that errors no longer persist! 🚫
LGTM, great job!
|
Description 📝
Ensures that VPC region, label, and description validation error messages do not persist for VPC create flow.
Preview 📷
Screen.Recording.2023-10-04.at.5.39.30.PM.mov
How to test 🧪