Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 4 months ago

#63712 closed defect (bug) (invalid)

Switching between Visual and Code editor in the Classic Editor (TinyMCE) generates new HTML elements

Reported by: gocemitevski's profile goce.mitevski Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.8.2
Component: TinyMCE Keywords: close
Focuses: administration Cc:

Description

The issue happens when creating or editing a post with the Classic editor.

Whenever you switch between the Visual and Code editor, the following new block of content gets appended to the post body.

 
<div style="pointer-events: none; border: medium;"></div>

Every time the post is saved and the user is in the Visual Editor the following line gets re-appended to the post body, so we get...

&nbsp;
<div style="pointer-events: none; border: medium;"></div>
<div style="pointer-events: none; border: medium;"></div>

The only way to get rid of this code is to remove it from the Code editor and save the post again. However, every time you switch back to the Visual editor it gets added again.

Attachments (2)

Screenshot from 2025-07-17 08-25-49.png (23.0 KB) - added by goce.mitevski 5 months ago.
video-42258022-0ab453acf327c9b5492f5ba4b016f3fc.mp4 (303.8 KB) - added by vishalmori 5 months ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @krupajnanda
5 months ago

  • Keywords needs-test-info added

Hello @gocemitevski

Thank you for opening this ticket. Please check this report shared below.

Reproduction Report

Description

With the given details, I tried to reproduce the issue but I am not able to replicate the same. It works as expected for me. However, any extra details like Test environment, Steps are really helpful in oder to replicate the issue around what exactly you are facing.

Environment

  • WordPress: 6.8.2
  • PHP: 8.2.15
  • Server: nginx/1.29.0
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.15)
  • Browser: Chrome 138.0.0.0
  • OS: macOS
  • Theme: Twenty Thirteen 4.4
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.6.7
    • Test Reports 1.2.0

Actual Results (Later Edit)

  1. ❌ I do not observe any new lines of block getting appended after switching.
Last edited 5 months ago by krupajnanda (previous) (diff)

#2 @vishalmori
5 months ago

For me, this issue first time came up while I was working on my project, where I needed to use a table in the WYSIWYG editor. I have a custom post type with "editor" support and "show_in_rest" set to false. I found this ticket just before I was about to create a new one.

Not div but it add "&nbsp;".

Yes, I have tested it on a clean WordPress 6.8.2 installation, with no plugins and the default theme and the issue still occurs.

I’m attaching a video showing one of the scenarios.

Last edited 5 months ago by vishalmori (previous) (diff)

#3 in reply to: ↑ 1 @goce.mitevski
5 months ago

  • Keywords close added; needs-test-info removed
  • Resolution set to invalid
  • Status changed from new to closed

Thanks @krupajnanda!

I did some additional digging and it seems that the problem is not in core WP but in the Harper extension for Firefox. I was using a version from this tree: https://github.com/Automattic/harper/tree/v0.51.0. Once I disabled the extension this additional content stopped being appended to the posts when switching between the editors.

I tried it in a fresh new WP install of 6.8.2 with only one additional plugin installed and activated - Classic Editor.

Though I was able to recreate what @vishalmori showed in his example, I think that's an entirely different issue.

Closing this ticket as invalid for WordPress core.

#4 @peterwilsoncc
4 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.