Make WordPress Core

Opened 9 years ago

Closed 5 years ago

#31219 closed defect (bug) (worksforme)

Divs get collapsed always since nbsp is not added.

Reported by: programmin's profile programmin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: TinyMCE Keywords:
Focuses: Cc:

Description

Here's a test you can see in most wp setups:
Start with a post that has:

<div>type here</div>

Press enter a few times, type more text. Now you have move divs.

Save and view, and you'll see the actual page has no enters, as it didn't replace the bogus br tags with &amp;nbsp.

Change History (4)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 years ago

#2 @boonebgorges
9 years ago

To clarify the original bug report a bit more:

  1. In Text mode, enter <div>foo bar</div>
  2. Switch to Visual mode
  3. Put the cursor between 'foo' and 'bar' and hit enter a few times
  4. Switching back to Text mode, you'll see that empty <div></div> elements have been created
  5. When publishing, the empty divs are stripped.

The suggestion made by programmin (awesome screenname, btw) is that these empty <div> elements ought to have some content in them so that they're not removed: <div>&nbsp;</div>. The consensus in the bug scrub was that this seems like very odd behavior.

So, the question is: what is the expected behavior here? Should we be creating the dummy divs? Should we be creating <p>s instead (and would that cause the same problem)? Maybe <br /> elements?

#3 @iseulde
9 years ago

Related: #28444.

This is a TinyMCE issue.

#4 @azaozz
5 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

As @iseulde points out, this is an issue (or rather design decision) in TinyMCE.

Note: See TracTickets for help on using tickets.