WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#14341 new defect (bug)

Adjacent image disappears when a caption is added

Reported by: designsimply Owned by:
Priority: normal Milestone: Future Release
Component: TinyMCE Version:
Severity: major Keywords: captions needs-patch
Cc:

Description

If you place two images side by side inside a strong tag and then try to add a caption to one of the images, the other image disappears.

Tested in r15436.

To reproduce:
1) Open a new or existing post for editing
2) Place the sample code from below into the html editor
3) Switch to the visual editor and try to add a caption
---> You'll see the other image disappear

Here is a screencast example: http://screencast.com/t/OTNmNjQzN

Here is some sample code:

<strong><a href="http://s.wordpress.org/about/images/logo-grey/grey-m.png"><img class="alignleft size-full" title="grey logo" src="http://s.wordpress.org/about/images/logo-grey/grey-m.png" alt="" width="100" height="100" /></a><a href="http://s.wordpress.org/about/images/logo-blue/blue-m.png"><img class="alignleft size-full" title="blue logo" src="http://s.wordpress.org/about/images/logo-blue/blue-m.png" alt="" width="100" height="100" /></a></strong>

Change History (3)

comment:1 nacin2 years ago

Is this a regression? I imagine not.

Can it be tested again on the new version of TinyMCE?

comment:2 mdawaffe2 years ago

  • Component changed from General to TinyMCE
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Severity changed from normal to major

Still broken in r17316.

comment:3 azaozz2 years ago

<strong> is an inline tag, inserting a block tag like <div> or <dd> in there makes the HTML invalid. I think the browsers have difficulties displaying such HTML in contentEditable mode. In order to "fix" the invalidly nested tags it seems TinyMCE removes the <strong> node leaving only the new block node there.

Not sure what we can do about these border cases where user edited code is later edited in the visual editor leading to invalid HTML.

Note: See TracTickets for help on using tickets.