Skip to content
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

Refactor URLInput component #19551

Closed
wants to merge 5 commits into from
Closed

Refactor URLInput component #19551

wants to merge 5 commits into from

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Jan 10, 2020

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 new LinkControl 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 like autoFocus and isRequired aren't hardcoded.

The BaseURLInput is configurable with different suggestion lists. It's used to build a URLInputWithInlineSuggestionList component (which implements the LinkControl style suggestion list) and URLInputWithPopoverSuggestionList (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:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

@talldan talldan closed this Mar 16, 2020
@talldan talldan deleted the refactor/url-input branch March 16, 2020 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Submitting a link in the navigation block using the enter key causes a console warning.
1 participant