block-components icon indicating copy to clipboard operation
block-components copied to clipboard

The content picker display html code as title for some edge cases

Open derweili opened this issue 6 months ago • 0 comments

Describe the bug

The content picker uses the title.rendered property from the REST-API to render the title on the PickedItemPreview component. This title.rendered property might contain HTML code depending on which plugin/theme is used. This HTML markup is then shown as plaintext to the user.

I think we should either render that html using dangerouslySetInnerHTML or we should use the title.raw instead of the title.rendered.

Steps to Reproduce

  1. Register a custom filter to the the_title() that adds html markup to the title
  2. Select a post on the post picker
  3. You will see the html markup being displayed as plaintext.

Screenshots, screen recording, code snippet

Image

Environment information

No response

WordPress information

No response

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

derweili avatar Jun 17 '25 09:06 derweili