Site logo

Archived topic

Suddenly empty paragraphs appearing

3 replies · Started by Dominik on March 15, 2021

Viewing posts 1–4 of 4

Hi,

I have a problem with some empty paragraphs that are suddenly appearing beneath random blocks. 2 different web-projects - same issue.
For example from one minute to the other the footer has a bottom spacing – inspect reveals that it's an empty paragraph. My workaround is to delete it manually but with bigger projects it's not possible. I edit the block, type something into the empty paragraph to bring up the menu and then delete it.

empty paragraph

The issue really appears randomly during workflow since maybe 1 week.

On the other project I was adding translations and after saving them, suddenly all languages have the paragraph beneath the woocommerce short description (the text is inserted via shortlink).

The paragraph gets its CSS from /wp-includes/css/dist/block-library/style.min.css?ver=5.7

Thanks
Manuel

Hi there,

I understand how frustrating this is but these empty paragraphs are user-added paragraph blocks. (usually unintended)

When you create any content(page, post, block element) through the Block Editor(Gutenberg), if you click on an empty space in the content area outside of a container block, the editor automatically creates a paragraph block even if you didn't type anything in it. This is a normal occurrence you should watch out for.

You'll normally see a placeholder text saying Start writing or type / to choose a block after unselecting this empty paragraph block.

It's not exactly a CSS issue, but rather, a Gutenberg issue. And the best practice, while it's tedious, is to make sure you have this removed. If you use a reusable block, make sure the reusable block doesn't have stray/empty paragraph blocks.

While you can attempt to fix this with CSS -

.woocommerce-product-details__short-description p:before {
    display: none;
}

- that's not good housekeeping as you're basically leaving these stray/empty paragraphs alone, potentially causing "excessive dom size" flags when you test for performance.

The thing is I didn't touch these blocks. I must have touched every single short description in every language (ca. 300 blocks). I didn't touch the footer or any other block where the paragraph appeared. It suddenly appears... Sometimes even twice. I delete the paragraph and a few days later the paragraph shows again.

I just found out that WPML could be the source of this problem. Here they mentioned that remove_filter('the_content', 'wpautop'); might solve the problem.

It does but not 100%. Some of the <p> are still here.

Hi Manuel,

Thanks for sharing us with this information.

We haven't received similar reports before, so we assume it's not GP issue.

Glad you figured it might be the translation plugin, hope they can provide a better solution for you, it seems a lot of work to manually delete the p block.

Let us know if there's anything we could help.

This archived topic is closed to new replies.