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

Parent blocks without inner blocks prints empty HTML tags on the front #63332

Open
carolinan opened this issue Jul 10, 2024 · 3 comments
Open
Labels
[Block] Buttons Affects the Buttons Block [Block] Columns Affects the Columns Block [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

Description

I found this issue with both the columns block and the buttons block, and it seemed appropriate to open one issue instead of two.
When you delete all inner button or column blocks, the parent, the wrapper, is still printed on the front of the website.

Of course, this is an edge case that should only happen if a user:

  • Is unsure of how to completely delete the block.
  • Made some changes and simply forgot to delete the parent.

Step-by-step reproduction instructions

Create a new post.
Add a columns block and a buttons block.
Delete the inner blocks, and save.
View the post on the front, and view the source.
Confirm that the block is present on the page.

Screenshots, screen recording, code snippet

<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex"></div>
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex"></div>

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@carolinan carolinan added [Type] Bug An existing feature does not function as intended [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Block] Columns Affects the Columns Block [Block] Buttons Affects the Buttons Block labels Jul 10, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Nov 20, 2024

I think this overlaps with #59996.

I see that @Infinite-Null is exploring solutions in #67147. But I think we need a more general solution to check if inner blocks are empty; it could be similar to RichText.isEmpty.

@ellatrix, @youknowriad, has anyone explored a similar solution in the past?

@ellatrix
Copy link
Member

For buttons, it should never be the case that only the wrapper remains; we should fix that. If you remove the last button, it should remove the wrapper.

For columns, I'm not sure I agree. If you leave the columns placeholder, it's fine that it leaves markup? I mean, it's obvious that you leave a placeholder in place?

@ellatrix
Copy link
Member

For lists and quote, it should be the same fix as buttons. Related: #40979.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Block] Columns Affects the Columns Block [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants