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

Document and rename showSuggestionsOverride to something more sensible #16497

Merged
merged 2 commits into from Jul 11, 2019

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Jul 10, 2019

Description

I added a small contribution to #10128 to fix a problem when hiding the URLInput. It was pointed out in review comments that the name of the prop could be improved, and documentation should be added.

Now that #10128 has been merged, here's the follow up addressing those comments.

How has this been tested?

  1. Add a button block
  2. Type in some text in the url input field that triggers the autocomplete suggestions to display
  3. Press tab to tab out of the field

Expected behaviour

The input is hidden due to the button block no longer being selected. The autocomplete suggestions are also hidden.

Screenshots

Types of changes

Code quality improvement (non-breaking change which fixes an issue)

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.

@talldan talldan added [Type] Developer Documentation Documentation for developers [Type] Code Quality Issues or PRs that relate to code quality labels Jul 10, 2019
@talldan talldan self-assigned this Jul 10, 2019
@talldan talldan requested a review from noisysocks July 10, 2019 09:13

When hiding the URLInput using CSS (as is sometimes done for accessibility purposes), the suggestions can still be displayed. This is because they're rendered in a popover in a different part of the DOM, so any styles applied to the URLInput's container won't affect the popover.

This prop allows the suggestions list to be progrmatically not rendered by passing a boolean—it can be `true` to make sure suggestions aren't rendered, or `false`/`undefined` to fall back to the default behaviour of showing suggestions when matching autocompletion items are found.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

progrmatically -> programmatically

@@ -223,9 +223,9 @@ class URLInput extends Component {
this.inputRef.current.focus();
}

static getDerivedStateFromProps( { showSuggestionsOverride }, { showSuggestions } ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we breaking back compatibility with current usages of showSuggestionsOverride? Should we keep supporting the existing prop but write a deprecated warning when it is used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added in #10128 (merged 16 hours ago) so I think we don't break anything.

Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@noisysocks noisysocks merged commit 4c55270 into master Jul 11, 2019
@noisysocks noisysocks deleted the update/url-input-suggestions-override branch July 11, 2019 01:55
@youknowriad youknowriad added this to the Gutenberg 6.2 milestone Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants