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

Entering ">" into the RichText component causes block validation failure #16252

Open
vrk opened this issue Jun 24, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@vrk
Copy link

commented Jun 24, 2019

You can repro this easily via my remix of the Gutenberg Block Kit Glitch project:
https://repro-richtext-bug.glitch.me/

Steps to repro:

  1. Go to https://repro-richtext-bug.glitch.me/
  2. Type > into the RichText component -- see that it renders as > (which might be a separate bug)
  3. Refresh the page

Expected behavior:

Should either render as literally >, or it should consistently evaluate the HTML entity and render>.

Actual behavior:

The block gets into a bad state after refreshing: "This block contains unexpected or invalid content"

Error in the console:

Block validation: Block validation failed for `gutenberg-block-kit/remix` (Object).

Content generated by `save` function:

<p class="wp-block-gutenberg-block-kit-remix">&gt;</p>

Content retrieved from post body:

<p class="wp-block-gutenberg-block-kit-remix">&amp;gt;</p>
(anonymous) @ validation.js:265

(I verified this also repros when installed in WordPress as well.)

Thanks for taking a look and let me know if there's any way I can help! Gutenberg and the Block Kit on Glitch have been very cool to play with!


Context: Why am I trying to write &amp;gt;, anyway?

I found this bug because I'm writing a rich text code block plugin that lets you write code snippets and also add basic styling to them (so that you can bold part of a code snippet).

My plugin basically works, but RichText renders HTML entities like ">" even when you set the attribute content to the escaped value (which I think is #15636).

I can imagine wanting to write &gt; in a code snippet, so until #15636 is fixed, my workaround was going to be to write &amp;gt;, which is what led me to this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.