Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +22 B (0%) Total Size: 2.99 MB
ℹ️ View Unchanged
|
talldan
left a comment
There was a problem hiding this comment.
It'd be great to fix this. In my recent use of the navigation block I found this bug is really disruptive. I'm surprised there haven't been more reports of the problem.
The e2e test failures seem related, so I guess they need to be fixed.
packages/block-editor/src/components/link-control/search-input.js
Outdated
Show resolved
Hide resolved
| hideLabelFromVision={ ! showTextControl } | ||
| isEntity={ isEntity } | ||
| customValidity={ customValidity } | ||
| required={ showTextControl } |
There was a problem hiding this comment.
Is it possible to completely remove the required prop? This code seems to bypass it anyway. It makes the input only 'required' when it has a value, in which case it will always pass the required validation.
There was a problem hiding this comment.
It does seem like required might be superfluous
There was a problem hiding this comment.
Ah...maybe it's because there is sometimes a text control as well?
There was a problem hiding this comment.
Yes, we need it required when there's a text control when editing an existing link via link control.
There was a problem hiding this comment.
Revisiting this, as I still get buggy behavior when editing when the showTextControl option is true. I think we can't rely on the default validation timing at the moment when using an input as a combobox.
Screen.Recording.2026-02-06.at.11.09.15.AM.mov
getdave
left a comment
There was a problem hiding this comment.
Testing this I wasn't able to submit invalid URLs but the validation message didn't show up when I took other actions such as Create New Page, Add Block...etc
If we can fix the tests I think this will be good to go.
aaacfd5 to
09d36df
Compare
|
Flaky tests detected in 09d36df. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/21753638420
|
scruffian
left a comment
There was a problem hiding this comment.
One minor comment but I think we can bring this in.
| suffix, | ||
| isEntity = false, | ||
| customValidity: customValidityProp, | ||
| required = false, |
There was a problem hiding this comment.
In url-input.js the default is false. Should we try to be consistent?
There was a problem hiding this comment.
In url-input, the default is true, so I think you're saying we should also default this to true?
There was a problem hiding this comment.
Sorry. I meant they should be the same, I don't really mind which is the default!
There was a problem hiding this comment.
Going with a secret third option - not setting a default at all. It's already passed into the search-input from the link control, so we don't need to set a default. It will inherit URLInput's default rather than set a new one.
Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
What?
Closes #75185
When using the LinkControl component (e.g., in the Navigation block), clicking the "Create Page" button or other suggestion items triggers a validation error: "Please fill out this field." This occurs because:
ValidatedInputControlwithrequired={true}ControlWithErrormarks blurred fields as "touched"This is problematic because the create page button is a separate action from link submission—it shouldn't trigger input validation.
Why?
Bug fix for UX error
How?
In #75188, I tried adding a "prevent validation on blur" behavior to the validation input. In this PR, I'm not marking the link control search input as required, because in some instances, it is not required. For example, when you click the "Create Page" button, the field can be empty or have any text in it. We don't want to validate it or require it.
Testing Instructions
Testing Instructions for Keyboard
Test: No validation on blur
Test: Validation on submit
Test: No validation error when clicking a suggestion
Screenshots or screencast