Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.42k stars 1.99k forks source link

hr HTML tags Breaking Paragraph Blocks and Classic Revisions Unless it's Inside <!-- wp:separator --> #94184

Closed mxhassani closed 2 weeks ago

mxhassani commented 2 months ago

Quick summary

Adding an HTML code that code that contains the <hr> code results in an eventually broken block. Block recovery attempts recovers what's before the <hr> tag but not what's after it.

If using classic revisions (wp-admin). If a revision contains that <hr> tag, all the content will be visible in the revisions view but anything under the tag will not be included in the restored version.

Steps to reproduce

  1. Using Gutenberg, on any post.
  2. Add a paragraph block and write anything - "Test"
  3. Edit the paragraph block as HTML and add an <hr> to the end, followed by some text.
  4. Click Edit visually.
  5. You will get an Attempt Block Recovery button
  6. Clicking it removes the <hr> tag and all that's after it

There are

What you expected to happen

To either just remove the <hr> tag or convert it into a separator block.

What actually happened

The <hr> tag is removed and all that's after it, inside that paragraph block.

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

If the above answer is "Yes...", outline the workaround.

Regarding the code.

Regarding the revisions.

Platform (Simple and/or Atomic)

Simple, Atomic, Self-hosted

Logs or notes

8631891-zen The user mentioned using Word and paste to Classic block when creating content.

github-actions[bot] commented 2 months ago

Support References

This comment is automatically generated. Please do not edit it.

retnonindya commented 2 months ago

@mxhassani - I'm afraid I can't see your report clearly here. This is what I see on my end:

Screenshot 2024-09-05 at 3 51 21โ€ฏPM

It might be the text you shared got markdown-ed (? Is that even a word?) Can you reshare the message, Mohamed? Thanks!

mxhassani commented 2 months ago

@retnonindya Thanks! It was the hr tags at it again, I put them inside quotes.

inaikem commented 1 month ago

Moving this to the main triage queue since we received an author reply >month ago.

Robertght commented 3 weeks ago

๐Ÿ“Œ REPRODUCTION RESULTS

๐Ÿ“Œ FINDINGS/SCREENSHOTS/VIDEO https://github.com/user-attachments/assets/bd4e9f3a-9ebd-4b25-9c15-3e99496df49e

๐Ÿ“Œ ACTIONS

๐Ÿ“Œ Message to Author @mxhassani I'm not sure if it's permitted to have


elements inside other ones, like paragraphs on Gutenberg, but I agree it could create mayhem for some users, especially with revisions. At the same time, I could not find another report so I've raised this as a bug on core: https://github.com/WordPress/gutenberg/issues/66467

cc @inaikem if you need to review this with someone from the Gutenberg team.

Robertght commented 2 weeks ago

@mxhassani I'm going to close this for now as we've heard from the core folks it's not planned thing, yet there's some room for improvement.

Ref: https://github.com/WordPress/gutenberg/issues/66467#issuecomment-2439953247

Please reopen if you find more cases like this.