Display embeds error message only when the form is submitted #10591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Testing Gutenberg 4.0.0-RC1 I noticed a confusing behavior about the Embeds blocks. As soon as you enter some content into the URL input there is an error message that is added under the URL input no matter if the URL is actually embeddable. I would suggest to wait untill the form has been submitted to eventually display this error. Otherwise some users like me might be confused to see this error although the URL is embeddable.
PS: this PR should fix #10355
Description
I've added a new property to the Embed block's state to track whether the form has been submitted or not.
How has this been tested?
I've tested using this URL https://vimeo.com/287192106 which is an embeddable one within the Gutenberg Editor on WordPress trunk (as Gutenberg is not working on branch 5.0 of WordPress ??).
I've also ran the tests suite.
Screenshots
The error message
The error message shows even if the URL is embeddable as the above GIF proves it.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: