WordPress.org

Make WordPress Core

Opened 2 weeks ago

Closed 2 weeks ago

#43984 closed defect (bug) (fixed)

Customize: JavaScript error when opening Text widget

Reported by: dlh Owned by: azaozz
Milestone: 4.9.6 Priority: normal
Severity: normal Version: trunk
Component: TinyMCE Keywords: has-patch commit fixed-major
Focuses: Cc:

Description

All that should be needed to replicate is to try to expand a Text widget in the Customizer.

The error is Uncaught TypeError: Cannot read property 'zIndex' of undefined, and it occurs here: https://github.com/WordPress/wordpress-develop/blob/6d2bcaa9b39264e5bc8145cf8895f303cabf3fcd/src/wp-admin/js/customize-controls.js#L9256. The error prevents the visual editor from loading.

I think the error began with the TinyMCE update in #43862. Unfortunately, I'm not sure where to begin looking within those changes for what the cause might be.

Attachments (1)

43984.diff (765 bytes) - added by subrataemfluence 2 weeks ago.
src/wp-admin/js/customize-controls.js

Download all attachments as: .zip

Change History (9)

#1 @subrataemfluence
2 weeks ago

I could reproduce the issue.

Sincewindow.tinymce.ui.FloatPanel is undefined, window.tinymce.ui.FloatPanel.zIndex is throwing the above error, i.e. zIndex of undefined. I am trying to find out.

Source file:

/wp-admin/js/customize-controls.js

Line #: 9259

Code block:

if ( ! window.tinymce.ui.FloatPanel.zIndex || window.tinymce.ui.FloatPanel.zIndex < 500001 ) {
   window.tinymce.ui.FloatPanel.zIndex = 500001;
}
Last edited 2 weeks ago by subrataemfluence (previous) (diff)

@subrataemfluence
2 weeks ago

src/wp-admin/js/customize-controls.js

#2 follow-up: @subrataemfluence
2 weeks ago

  • Keywords has-patch added; needs-patch removed

My proposed patch currently takes care about the error message and prevents it from popping up on the console.

However, I believe why window.tinymce.ui.FloatPanel is showing undefined is more likely to be the area to inspect.

#3 @subrataemfluence
2 weeks ago

  • Keywords 2nd-opinion added

#4 @mermel
2 weeks ago

I can confirm I'm seeing the issue, and it's related to the upgrade.

#5 in reply to: ↑ 2 @azaozz
2 weeks ago

Replying to subrataemfluence:

However, I believe why window.tinymce.ui.FloatPanel is showing undefined is more likely to be the area to inspect.

Right, seems the wp-before-tinymce-init event fires too early. Switching to tinymce-editor-setup (fired when the wordpress plugin starts to load) fixes it.

Going to commit this for easier testing, also pinging @westonruter to have a look if possible.

#6 @azaozz
2 weeks ago

In 43181:

TinyMCE: fix setting of zIndex on the dialogs.

Props subrataemfluence, azaozz.
See #43984.

#7 @azaozz
2 weeks ago

  • Component changed from Customize to TinyMCE
  • Keywords commit fixed-major added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to 4.9.6

#8 @azaozz
2 weeks ago

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

In 43182:

TinyMCE: fix setting of zIndex on the dialogs.

Props subrataemfluence, azaozz.
Merges [43181] to the 4.9 branch.
Fixes #43984.

Note: See TracTickets for help on using tickets.