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

Rendering empty paragraph blocks #15918

Closed
edirpedro opened this issue May 30, 2019 · 8 comments
Closed

Rendering empty paragraph blocks #15918

edirpedro opened this issue May 30, 2019 · 8 comments
Labels
[Block] Paragraph Affects the Paragraph Block [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended

Comments

@edirpedro
Copy link

edirpedro commented May 30, 2019

The editor is rendering empty paragraph blocks and this always cause some issues in the front-end, placing empty spaces on screen that breaks the design and the client can't understand what is happening and how to fix it.

It's hard to fix too because the paragraphs can appear on the editor with just a click or using the arrow keys to navigate through the blocks. It's easy to create those empty tags when editing some content. I can understand the way the editor add this block automatically, but if empty, the editor shouldn't save them without some content, at least a space to indicate that it was really intentional.

Moving between blocks using arrow keys creates empty paragraph blocks

ezgif-1-88041265fa1a

They are saved and rendered on the front-end

Captura de Tela 2019-05-30 às 11 07 02

Testing on WordPress 5.2.1

@talldan
Copy link
Contributor

talldan commented May 31, 2019

Hi @edirpedro - thanks for creating the issue. Are you specifically talking about an empty paragraph at the end of a post? It's a bit hard to tell, because in your screen capture it's an empty paragraph between blocks.

I wasn't able to reproduce it in my editor. I tried:

  1. Add a block
  2. Add another block
  3. Use arrow keys to navigate between them.

Result: no unexpected blocks were added.

If you can provide some specific steps that others can follow to reproduce the issue that would be really helpful. Thanks.

@talldan talldan added [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended [Block] Paragraph Affects the Paragraph Block labels May 31, 2019
@edirpedro
Copy link
Author

  1. Add a columns block
  2. Add an image block inside each one
  3. Use arrows keys to navigate between them

Another way is just starting a document and hit enter to add new paragraphs. The empty tag <p> will be saved and rendered in the front.

Captura de Tela 2019-05-31 às 09 48 13

Results in:

<h1>Gutenberg</h1>
<p></p>
<p></p>
<p></p>
<p></p>

In my opinion, only a paragraph with some space <p> </p> should be saved as intentional, when empty, the editor should remote it when saving.

@senadir
Copy link
Contributor

senadir commented Jun 3, 2019

some people use empty paragraphs for spacing between blocks of text, removing them all together might cause problems & compatibility issues

a fix you can implement on your side is to hide empty paragraphs all together

p:empty {
    display: none;
}

or hide the last one if you wish

p:empty:last-of-type {
    display: none;
}

@swissspidy
Copy link
Member

Previously reported in #10051, #13599. Also related: #11238.

@edirpedro
Copy link
Author

I was thinking about and first, using empty paragraphs is how text editors works and how people usually write when they need some space in the document, second, for web development this can be intended as a bug because empty tags is not a good practice.

As a developer I would like to see this "feature" removed, but i'm not sure how this would affect other people who will write content. But Gutenberg doesn't work exactly like a text editor because of the block elements used to create content, the interface is not clean like a text editor is, so empty paragraphs does not seems to fit good on it. In my recorded video you can see that they break good rendering even on the Gutenberg side.

There is a Spacer block so I think that this element should be the right one to create spaces inside Gutenberg and not empty blocks.

@senadir
Copy link
Contributor

senadir commented Jun 3, 2019

maybe we can find a way to keep compatibility & encourage the use of the Spacer Block

@jkd77
Copy link

jkd77 commented Jun 26, 2019

Has there been any movement on this issue? If there's an empty block awaiting text (for admin convenience) it should either be deletable in back-end or should not render an empty element on the front-end. Visual element spacing should be the purview of style / css and not empty paragraphs.

@youknowriad
Copy link
Contributor

Let's close this as a duplicate to #10051 to keep discussions focused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants