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

Empty HTML comments are rendered in the editor #48408

Open
oandregal opened this issue Feb 24, 2023 · 2 comments
Open

Empty HTML comments are rendered in the editor #48408

oandregal opened this issue Feb 24, 2023 · 2 comments
Assignees
Labels
[Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f [Package] Blocks /packages/blocks [Type] Bug An existing feature does not function as intended

Comments

@oandregal
Copy link
Member

oandregal commented Feb 24, 2023

Related #47212 #38984

Description

Empty HTML comments are rendered in the editor, though they should not be.

Step-by-step reproduction instructions

  • Add the following code to the single.html template of TwentyTwentyThree:
<!--
        title: Title for the template or part
        area: related-area
-->
  • Go to the site editor and navigate to the single.html template. This is what I see:

Captura de ecrã de 2023-02-23 17-39-18

  • The front-end doesn't render the HTML comment:

image

@oandregal oandregal added the [Type] Bug An existing feature does not function as intended label Feb 24, 2023
@oandregal oandregal added the [Package] Blocks /packages/blocks label Feb 24, 2023
@mcsf mcsf self-assigned this Feb 27, 2023
@mrfoxtalbot mrfoxtalbot added the [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop label Mar 7, 2023
@bobbingwide
Copy link
Contributor

bobbingwide commented Mar 9, 2023

I'm not sure what exactly is meant by "empty", but my experience is that the HTML comment is rendered inside a paragraph.

Input was from a template starting

<!-- An HTML comment -->
<div class="WP_DEBUG">Fizzie front-page.html</div>

On the front-end this is rendered as is.

In the site editor the comment gets wrapped in a paragraph tag.
image

If this template is Saved the unwanted paragraph remains.

@bobbingwide
Copy link
Contributor

bobbingwide commented Mar 9, 2023

In other instances <br /> tags may be added where there were new lines in the original template HTML.

<div class="WP_DEBUG">Fizzie front-page.html
<!-- Comment in div -->
</div>

becomes

<div class="WP_DEBUG">Fizzie front-page.html<br />
<!-- Comment in div -->
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f [Package] Blocks /packages/blocks [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants