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

Hide appender on BlockPreviews via checking for null component in BlockListAppender #16887

Merged
merged 3 commits into from
Aug 2, 2019

Conversation

getdave
Copy link
Contributor

@getdave getdave commented Aug 2, 2019

Previously if a null component was passed to the BlockList component it would still render an empty <div className="block-list-appender"> element. This because we didn't check for null before rendering.

This is useful because we sometimes want to disable the rendering of the Block appender UI. For example in block previews.

Required for #16873

How has this been tested?

  • Insert quote Block with content
  • Switch style of Block
  • Inspect the Block Preview of the Style. See no <div className="block-list-appender"> component.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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.

Passing the null component here means the appender is not rendered
@getdave getdave added the [Package] Block editor /packages/block-editor label Aug 2, 2019
@getdave getdave self-assigned this Aug 2, 2019
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Pushed a tweak, merge if it works for you.

@getdave
Copy link
Contributor Author

getdave commented Aug 2, 2019

Thanks @youknowriad. Using false is much clearer than passing a null Component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants