WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27605 closed defect (bug) (fixed)

WP Editor link dialog content visible before Tiny MCE is initialized

Reported by: mattheu Owned by: nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Editor Keywords: has-patch commit dev-reviewed
Focuses: ui Cc:
PR Number:

Description

To reproduce:

  • Add a tinyMCE using wp_editor() to an options page, inside a hidden element.
  • The content of the editor link dialog is displayed at the bottom of the page. See screenshot below.
  • When the hidden element is shown, initialize the editor. The link dialog content disappears.

https://dl.dropboxusercontent.com/s/qijk9yontf8zbdd/2014-03-31%20at%2010.33.png

This happens because the link dialog is hidden using CSS found in editor.css.

This is not loaded until the TinyMCE editor is initialized, so until this point the content is visible, but unstyled.

This patch fixes this bug by hiding the wp-link-wrap element using an inline style so it is not visible on page load.

Attachments (3)

27605.diff (780 bytes) - added by mattheu 6 years ago.
27605-2.diff (781 bytes) - added by mattheu 6 years ago.
Fix typo
test.php (463 bytes) - added by mattheu 6 years ago.
Test

Download all attachments as: .zip

Change History (12)

@mattheu
6 years ago

#1 @azaozz
6 years ago

Yes, wpLink used to have an inline style in 3.8. The patch has a typo, missing a >.

#2 @jeremyfelt
6 years ago

  • Milestone changed from Awaiting Review to 3.9

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


6 years ago

@mattheu
6 years ago

Fix typo

#4 @nacin
6 years ago

mattheu, could you supply some code to trigger this? This is not easy to reproduce.

@mattheu
6 years ago

Test

#5 @mattheu
6 years ago

The issue came to light whilst testing this plugin: https://github.com/humanmade/Custom-Meta-Boxes

However I have uploaded some code that allows you to reproduce the issue easily.

I was actually slightly mistaken in my original description.
Load the page with editor visible.
The issues occurs when you remove an editor and the editor stylesheet also.

I realize this is pretty edge case... and I would be happy to allow for it in my plugin. However as this did not occur on 3.8, I thought it was worth raising!

#6 @nacin
6 years ago

After testing this, it seems like the CSS file should be printed before the editor wrap div. However, in the example posted, it's clear that a custom container is removed, not what gets printed, which would include the CSS file either way.

I'm fine with this, but in order for it to not regress, I'd like there to be a comment of some sort.

Another note to make: class="hidden" won't work on the frontend, so we resort to an inline style.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


6 years ago

#8 @nacin
6 years ago

  • Keywords has-patch commit dev-reviewed added

Good to go, per me, markjaquith, also azaozz.

#9 @nacin
6 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 28071:

Editor: Ensure the link dialog does not display when styles are missing.

props mattheu.
fixes #27605.

Note: See TracTickets for help on using tickets.