-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Navigation Screen: Display error notice inside modal #34884
Conversation
Size Change: +143 B (0%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
Side note: I think we should update the modal design to match other "action modals" in editors. The template modal example and similar conversation for Gallery block #34606 (comment) |
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.
Nice work noticing and fixing this.
Nit: I spotted one thing. If I enter and invalid entry and the notice is already displayed and then it's not obvious why submit isn't working. This is because the (original) notice doesn't disappear when the text in the input is changed.
Screen.Capture.on.2021-09-16.at.16-02-40.mp4
Perhaps it should clear the notice as soon as new text is entered. That way if you enter another invalid value it's more obvious why it has failed.
Good point, Dave. I also thought that maybe we should drop client-side validation in favor of the REST error response. It should fix the issue you mentioned.
|
I also spotted another problem: if you create a menu with one or more spaces as the name, you get the error message behind the modal.
+1, good idea |
That's one of the reasons I'm suggesting using server-side validation. There are various reasons the Menu creating might fail. |
@getdave, @javierarce If that's okay with you, I would instead add server-side error notices as a follow-up PR to make it easier to review. |
I gave it a test and it looks really good so far. It'd be good to look at improving the error message from the server for an empty menu name - "A name is required for this term.". The error for a duplicate menu is the same as on the client, so could potentially switch to using only server errors. Equally I think it would be fine to improve the client side validation to cover more cases. It's completely up to you. Do you plan to work on that as an alternative PR, @Mamaduka, or something built on top of this one? |
The second PR will build on top of this one. |
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.
Approving pending follow up with server side API responses. Nice work!
Description
The default notices appear under the modal screen overlay. PR updates the
AddMenu
component to use local notices and display them inside the form.The success still displays the Snackbar message.
Fixes #31100.
How has this been tested?
Screenshots
Types of changes
Bugfix
Checklist:
*.native.js
files for terms that need renaming or removal).