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

Render out HTML characters in post and category titles #30661

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

moorscode
Copy link
Contributor

Description

In the navigation section of the full site editing, the post and category titles can be displayed with the &#....; version of the characters.

This change will make sure the titles are rendered in a virtual DIV and the "flat" innerText is used to be displayed in the menu.

How has this been tested?

The first part of the items in the list is how the text is entered.
The second part is how it is displayed in the menu with the changes from the PR.

Created categories with the following names:

  • Three … dots --> Three ... dots
  • Three ... dots --> Three ... dots
  • Some " double quote --> Some " double quote
  • Some " double quote --> Some " double quote
  • Some <b> html --> Some html

Note: After saving the quotes and three-dots will be sanitized out.

Created posts with the following titles:

  • Quote " quote --> Quote " quote
  • Other &#34; quote --> Quote " quote
    • note this is not being shown consistently in the system.
      • The post overview shows the " version
      • The block editor shows the &#34; version
      • The Site Editor shows the " version in the menu, but the &#34; version in the page
      • The theme shows the " version
  • Three &#8230; dots --> Three ... dots
    • note this is being shown as '...' everywhere, thus having different behaviour in relation to the &#34; example above!

Screenshots

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

In the navigation section of the full site editing, the post and category titles can be displayed with the `&#....;` version of the characters.

This change will make sure the titles are rendered in a virtual DIV and the "flat" innerText is used to be displayed in the menu.
@aristath aristath added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended labels Apr 9, 2021
@aristath aristath linked an issue Apr 9, 2021 that may be closed by this pull request
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works as advertised.
We should probably have a helper for that createElement -> innerText thing since we use it in multiple places, but that's not related to this PR.

Approving since it's simple, the code looks good, and it fixes the issue 👍

@aristath aristath requested review from david-szabo97 and gziolo April 9, 2021 12:16
@david-szabo97
Copy link
Member

Works great! Thanks for fixing this! Can you add a test to make sure we don't break this in the future?

Copy link
Member

@david-szabo97 david-szabo97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@david-szabo97 david-szabo97 merged commit de37be2 into WordPress:trunk Apr 30, 2021
@github-actions github-actions bot added this to the Gutenberg 10.6 milestone Apr 30, 2021
@moorscode moorscode deleted the issue/30657 branch April 11, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post title special characters are encoded in Site Editor
3 participants