WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.3k stars 4.11k forks source link

Visual Editor: HTML Tags Visible in Post Title #60482

Open akmyta opened 5 months ago

akmyta commented 5 months ago

Description

Since the most recent update, adding HTML tags in the visual editor no longer work. Not only will it not apply the requested HTML but also appears visibly in the published post title.

Previously, it was possible to add HTML tags in the visual editor. HTML tags do appear as expected when inputted in the code editor.

Step-by-step reproduction instructions

  1. Create a new post (in visual editor) with HTML-Tags in the title for example: "This is my title"
  2. Save and publish the post with this title
  3. Review post and see that it has published with HTML-tags visible

Screenshots, screen recording, code snippet

This is how it would look in the visual editor: html-tag1

This is the expected outcome: html-tag3

And this was the actual result: html-tag2

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

talldan commented 5 months ago

Previously, it was possible to add HTML tags in the visual editor.

@akmyta I think HTML tags have to be added via the code editor and not the visual editor. Possibly this was changed at some point, but I'm not exactly sure of the history.

I've tested, and adding tags is possible if you do it via the code editor. Via the visual editor the tags are escaped.

dansinker commented 5 months ago

Possibly this was changed at some point, but I'm not exactly sure of the history.

This was not the case prior to 6.5's rollout this week. Has disrupted our editorial workflow significantly.

akmyta commented 5 months ago

@talldan If I complete the same steps in WordPress version 6.4.3 - it works as expected.

https://github.com/WordPress/gutenberg/assets/35075802/ae7564ba-31a1-4b1c-b6b9-051d680e7992

t-hamano commented 5 months ago

I researched this issue via Playground and it works as expected from WP6.1 to WP6.4. In WP6.5, HTML tags are escaped. I don't yet know if this is an intentional change.

t-hamano commented 5 months ago

I have confirmed that this change was intentional and was made by #54718.

The main purpose seems to be to match the look of the title in the editor and the frontend. It's also mentioned that we can't add or edit HTML in visual mode, so perhaps the ideal approach would be to implement a formatting toolbar in the title.

talldan commented 5 months ago

IMO, the change takes things in the right direction. It makes more sense to add the tags in the code editor view, since that's where html is generally added, and it's now also possible to view the result of the html tags in visual mode.

As @t-hamano mentioned, it's perhaps an issue that there's no way to add formatting visually and some users may have the code editor disabled. Perhaps we keep this issue open to discuss that aspect?

I've removed the bug label since it works as intended currently.

t-hamano commented 5 months ago

It might be better to keep this issue open as an "Enhancement" that adds a formatting toolbar to the post title when in visual mode.

dansinker commented 5 months ago

Yeah, keeping this open for discussion on adding a formatting toolbar to the post title is great.

So you understand the use-case here:

Proper formatting of titles (books, albums, movies, etc) is to italicize them. The publication I work for has covered culture for 50 years, and regularly italicizes titles in their headlines (happened 3-4 times the day after the 6.5 update and nobody knew what was happening). Asking our editors to fire up the code editor to do something that should be part of normal editorial workflow seems like a lot, not to mention that inevitibly they will break something in the process.

talldan commented 5 months ago

Asking our editors to fire up the code editor to do something that should be part of normal editorial workflow seems like a lot, not to mention that inevitibly they will break something in the process.

@dansinker Another option is to use 'Quick Edit' from the post list to add the formatting, not sure if that's any easier.

dansinker commented 4 months ago

@talldan yes, that's what we've instructed them to do, but it's still a slower process than what they had before. ultimately it really does seem like if the idea is that the visual editor should allow for visual editing only, then adding visual editing to the title is the correct solution.

MadtownLems commented 4 months ago

+1 to the idea of the Post Title box having a basic toolbar for formatting, such as Italics. Our users don't have the ability to access Code Editor, but still need to be able to use italics (for things like the scientific name of plants). Thanks @talldan so much for the suggestion of using Quick Edit as a workaround for now!

HeinMynn commented 4 months ago

+1 for the formatting toolbar for the Post Title.

dlh01 commented 3 months ago

I've observed since updating to 6.5 that the & character is converted to & in the post title as soon as it's typed, regardless of the user's role or capabilities. The encoded character then gets saved to the database.

Having & converted by KSES on save for users without the necessary capabilities has been a longstanding problem (see #20490), but this seems different.

I'm not positive that this change in behavior is caused by the same change being discussed here, so feel free to direct my comment to a better place if there is one.