Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36662 closed defect (bug) (fixed)

WpLink stopped working in bootstrap modals.

Reported by: jackreichert's profile jackreichert Owned by: azaozz's profile azaozz
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.5
Component: Editor Keywords:
Focuses: javascript Cc:

Description (last modified by swissspidy)

Since updating to 4.5 wplink won't work on a page that has 'modal-open' on the body. This class is added by bootstrap modals plugin (https://github.com//twbs/bootstrap/blob/master/js/modal.js#L63).

This was introduced in revision [36677] on line 390 (https://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js?rev=36677#L390). It was unclear to me from the commit message why it was added.

Change History (8)

#1 @swissspidy
8 years ago

  • Description modified (diff)
  • Focuses administration removed

#2 @azaozz
8 years ago

This was added to prevent the inline link toolbar opening while a modal is shown or showing over open modals. There are cases when a modal would focus the editor that's under it, and as we show the inline toolbar on editor focus, it would open.

Will have to change this behaviour (although it seems logical) or find another way to detect when the editor is actually visible and accessible and when it is under a modal (if that is at all possible).

#3 @jackreichert
8 years ago

That certainly makes sense, I submitted the ticket because I have implemented instances of wp_editor inside a modal.

#4 @jackreichert
8 years ago

Perhaps using document.elementFromPoint(x,y) would work since we're already absolute positioning wplink...

#5 @azaozz
8 years ago

Yes, document.elementFromPoint() should work but we will have to account for all cases like inline editor, a "real" iframe with an iframe editor in it, etc. As TinyMCE is very easy to customize, detecting all cases can be somewhat tricky.

Alternatively can set a flag only for the wpLink modal. Seems this would cover it for now as all other modals there have higher z-index/are "over" the toolbar.

Last edited 8 years ago by azaozz (previous) (diff)

#6 @azaozz
8 years ago

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

In 37630:

Editor: do not use the modal-open class to determine when the wpLink modal is open. This is a class used in Bootstrap and may be present when wpLink is not open. Store the open/closed state instead.

Fixes #36662.

#7 @azaozz
8 years ago

  • Milestone changed from Awaiting Review to 4.6

#8 @pento
8 years ago

In 37632:

Editor: 'undefined' !== 'undefiend'

Fix a typo in [37630].

See #36662.

Note: See TracTickets for help on using tickets.