-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Description
In the new widget editor, Custom HTML widget blocks can get (additional) paragraph and line break tags.
Originally reported by jim5471 on Trac #53778
Step-by-step reproduction instructions
- Go to Dashboard > Appearance > Widgets.
- Insert a Custom HTML Block into the footer and insert this code:
<div><p>some text</p>
<a href="http://www.test.com">link text</a>
</div>
<svg height="90" width="200">
<text x="10" y="20" style="fill:red;">Several lines:
<tspan x="10" y="45">First line.</tspan>
<tspan x="10" y="70">Second line.</tspan>
</text>
</svg>
- Update and check it appears on the webpage and is correct.
- Go back to Dashboard and then back to Appearance > Widgets.
- Observe the Custom HTML code has additional paragraph and line break tags.
Firefox:
<div>
<p>some text</p>
<p><a href="http://www.test.com">link text</a>
</p></div>
<p><svg height="90" width="200"><br></br>
<text x="10" y="20" style="fill:red;">Several lines:<br></br>
<tspan x="10" y="45">First line.</tspan><br></br>
<tspan x="10" y="70">Second line.</tspan><br></br>
</text><br></br>
</svg></p>
Edge/Chrome:
<div>
<p>some text</p>
<p><a href="http://www.test.com">link text</a>
</p>
</div>
<p><svg height="90" width="200"></svg><br>
<text x="10" y="20" style="fill:red;">Several lines:<br>
<tspan x="10" y="45">First line.</tspan><br>
<tspan x="10" y="70">Second line.</tspan><br>
</text>
</p>
- Change another widget and update.
- Go back to Dashboard and then back to Appearance > Widgets.
- In Chrome and Edge, the code stays the same as in step 5. In Firefox, though, the Custom HTML code changes again:
<div>
<p>some text</p>
<p><a href="http://www.test.com">link text</a>
</p>
</div>
<p><svg height="90" width="200"><br></br></svg><br><br>
<text x="10" y="20" style="fill:red;">Several lines:<br><br><br>
<tspan x="10" y="45">First line.</tspan><br><br><br>
<tspan x="10" y="70">Second line.</tspan><br><br><br>
</text><br><br><br>
</p>
Expected Behavior
The Custom HTML block widget contents should remain exactly as entered.
Current Behavior
The block widget has autop formatting (from @wordpress/autop).
WordPress Information
WordPress 5.8
Twenty Twenty-One theme
no plugins
local installation with PHP 7.3.21
Gutenberg Information
Gutenberg not activated
What browsers are you seeing the problem on?
Firefox, Chrome, Microsoft Edge
Device Information
Desktop browsers:
Google Chrome 92.0.4515.107 (64-bit) - Incognito mode
Mozilla Firefox 90.0.2 (64-bit) - Private window
Microsoft Edge Version 92.0.902.62 (64-bit)
Operating System Information
Windows 10 Home 20H2 19042.1110
Is there an existing issue for this?
- I have searched the existing issues
Have you tried deactivating all plugins except Gutenberg?
- I have tested with all plugins deactivated.
Have you tried replicating the bug using a default theme e.g. Twenty Twenty?
- I have tested with a default theme.