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.
Fixes #19056 in a round-about way.
Description
URLInput
has for a while been a difficult component to work with, it's quite opinionated, and has some pretty complicated business-logic mixed with ui-logic. My feeling with this component, and the newLinkControl
is that it might be cleaner to move towards a set of presentational components that aren't coupled to any WordPress specific code, and could live in@wordpress/components
.This PR attempts to decouple the component into
BaseURLInput
a presentational component that has no wordpress-specific logic. I could imagine this component in the future having minimal styles for an input and being less opinionated so that things likeautoFocus
andisRequired
aren't hardcoded.The
BaseURLInput
is configurable with different suggestion lists. It's used to build aURLInputWithInlineSuggestionList
component (which implements the LinkControl style suggestion list) andURLInputWithPopoverSuggestionList
(which implements the old popover style suggestion list, which may be something to get rid of in the future when it's no longer used).The PR is still a bit buggy and needs further work, I had to move a lot of business logic around so there are still a few things to tidy up.
How has this been tested?
Just manual testing so far.
Types of changes
Refactor
Checklist: