<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[41356] trunk/src: Administration: Thickbox: Fix conflicts with the Plugin details and native Thickbox modals.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/41356">41356</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/41356","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>afercia</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-09-09 14:13:28 +0000 (Sat, 09 Sep 2017)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Administration: Thickbox: Fix conflicts with the Plugin details and native Thickbox modals.

The Plugin details modal custom implementation in the Plugins page conflicts with
other Thickbox instances added by plugins. Thickbox shows its age and has been
modified over time to suit core needs. However, WordPress should do its best to
not create conflicts with the native Thickbox styles and functionalities. Plugin
authors should be able to use `add_thickbox()` in any admin page as documented, 
without having to worry about potential errors.

- fixes a JavaScript error when closing a native Thickbox modal in the Plugins page
- avoids to override the native Thickbox modal styles
- uses a CSS class to target the Plugin details modal and remove a pile of overqualified CSS selectors

Fixes <a href="https://core.trac.wordpress.org/ticket/41417">#41417</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscommoncss">trunk/src/wp-admin/css/common.css</a></li>
<li><a href="#trunksrcwpadminjsplugininstalljs">trunk/src/wp-admin/js/plugin-install.js</a></li>
<li><a href="#trunksrcwpincludesjsthickboxthickboxcss">trunk/src/wp-includes/js/thickbox/thickbox.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsscommoncss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/common.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/common.css 2017-09-09 13:52:46 UTC (rev 41355)
+++ trunk/src/wp-admin/css/common.css   2017-09-09 14:13:28 UTC (rev 41356)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2864,33 +2864,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* Thickbox for Plugin Install screen */
-body.about-php #TB_window,
-body.plugin-install-php #TB_window,
-body.import-php #TB_window,
-body.plugins-php #TB_window,
-body.update-core-php #TB_window,
-body.index-php #TB_window {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Thickbox for the Plugin details modal. */
+#TB_window.plugin-details-modal {
</ins><span class="cx" style="display: block; padding: 0 10px">         background: #fcfcfc;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* IE 8 needs a change in the pseudo element content */
-.ie8 body.about-php #TB_window:before,
-.ie8 body.plugin-install-php #TB_window:before,
-.ie8 body.import-php #TB_window:before,
-.ie8 body.plugins-php #TB_window:before,
-.ie8 body.update-core-php #TB_window:before,
-.ie8 body.index-php #TB_window:before {
-       content: " ";
-       background: none;
-}
-
-body.about-php #TB_window.thickbox-loading:before,
-body.plugin-install-php #TB_window.thickbox-loading:before,
-body.import-php #TB_window.thickbox-loading:before,
-body.plugins-php #TB_window.thickbox-loading:before,
-body.update-core-php #TB_window.thickbox-loading:before,
-body.index-php #TB_window.thickbox-loading:before {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#TB_window.plugin-details-modal.thickbox-loading:before {
</ins><span class="cx" style="display: block; padding: 0 10px">         content: "";
</span><span class="cx" style="display: block; padding: 0 10px">        display: block;
</span><span class="cx" style="display: block; padding: 0 10px">        width: 20px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2910,80 +2889,38 @@
</span><span class="cx" style="display: block; padding: 0 10px">        (-webkit-min-device-pixel-ratio: 1.25),
</span><span class="cx" style="display: block; padding: 0 10px">        (min-resolution: 120dpi) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        body.about-php #TB_window.thickbox-loading:before,
-       body.plugin-install-php #TB_window.thickbox-loading:before,
-       body.import-php #TB_window.thickbox-loading:before,
-       body.plugins-php #TB_window.thickbox-loading:before,
-       body.update-core-php #TB_window.thickbox-loading:before,
-       body.index-php #TB_window.thickbox-loading:before {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ #TB_window.plugin-details-modal.thickbox-loading:before {
</ins><span class="cx" style="display: block; padding: 0 10px">                 background-image: url(../images/spinner-2x.gif);
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body.about-php #TB_title,
-body.plugin-install-php #TB_title,
-body.import-php #TB_title,
-body.plugins-php #TB_title,
-body.update-core-php #TB_title,
-body.index-php #TB_title {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal #TB_title {
</ins><span class="cx" style="display: block; padding: 0 10px">         float: left;
</span><span class="cx" style="display: block; padding: 0 10px">        height: 1px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body.about-php #TB_ajaxWindowTitle,
-body.plugin-install-php #TB_ajaxWindowTitle,
-body.import-php #TB_ajaxWindowTitle,
-body.plugins-php #TB_ajaxWindowTitle,
-body.update-core-php #TB_ajaxWindowTitle,
-body.index-php #TB_ajaxWindowTitle {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal #TB_ajaxWindowTitle {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* only on these screens */
-.about-php #TB_closeWindowButton,
-.plugin-install-php #TB_closeWindowButton,
-.import-php #TB_closeWindowButton,
-.plugins-php #TB_closeWindowButton,
-.update-core-php #TB_closeWindowButton,
-.index-php #TB_closeWindowButton {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal #TB_closeWindowButton {
</ins><span class="cx" style="display: block; padding: 0 10px">         left: auto;
</span><span class="cx" style="display: block; padding: 0 10px">        right: -30px;
</span><span class="cx" style="display: block; padding: 0 10px">        color: #eee;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-body.about-php #TB_closeWindowButton:hover,
-body.about-php #TB_closeWindowButton:focus,
-body.plugin-install-php #TB_closeWindowButton:hover,
-body.plugin-install-php #TB_closeWindowButton:focus,
-body.import-php #TB_closeWindowButton:hover,
-body.import-php #TB_closeWindowButton:focus,
-body.plugins-php #TB_closeWindowButton:hover,
-body.plugins-php #TB_closeWindowButton:focus,
-body.update-core-php #TB_closeWindowButton:hover,
-body.update-core-php #TB_closeWindowButton:focus,
-body.index-php #TB_closeWindowButton:hover,
-body.index-php #TB_closeWindowButton:focus {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal #TB_closeWindowButton:hover,
+.plugin-details-modal #TB_closeWindowButton:focus {
</ins><span class="cx" style="display: block; padding: 0 10px">         color: #00a0d2;
</span><span class="cx" style="display: block; padding: 0 10px">        outline: none;
</span><span class="cx" style="display: block; padding: 0 10px">        box-shadow: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body.about-php .tb-close-icon,
-body.plugin-install-php .tb-close-icon,
-body.import-php .tb-close-icon,
-body.plugins-php .tb-close-icon,
-body.update-core-php .tb-close-icon,
-body.index-php .tb-close-icon {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal .tb-close-icon {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body.about-php #TB_closeWindowButton:after,
-body.plugin-install-php #TB_closeWindowButton:after,
-body.import-php #TB_closeWindowButton:after,
-body.plugins-php #TB_closeWindowButton:after,
-body.update-core-php #TB_closeWindowButton:after,
-body.index-php #TB_closeWindowButton:after {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.plugin-details-modal #TB_closeWindowButton:after {
</ins><span class="cx" style="display: block; padding: 0 10px">         content: "\f335";
</span><span class="cx" style="display: block; padding: 0 10px">        font: normal 32px/29px 'dashicons';
</span><span class="cx" style="display: block; padding: 0 10px">        speak: none;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2993,12 +2930,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /* move plugin install close icon to top on narrow screens */
</span><span class="cx" style="display: block; padding: 0 10px"> @media screen and ( max-width: 830px ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        body.about-php #TB_closeWindowButton,
-       body.plugin-install-php #TB_closeWindowButton,
-       body.import-php #TB_closeWindowButton,
-       body.plugins-php #TB_closeWindowButton,
-       body.update-core-php #TB_closeWindowButton,
-       body.index-php #TB_closeWindowButton {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ .plugin-details-modal #TB_closeWindowButton {
</ins><span class="cx" style="display: block; padding: 0 10px">                 right: 0;
</span><span class="cx" style="display: block; padding: 0 10px">                top: -30px;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="trunksrcwpadminjsplugininstalljs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/plugin-install.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/plugin-install.js   2017-09-09 13:52:46 UTC (rev 41355)
+++ trunk/src/wp-admin/js/plugin-install.js     2017-09-09 14:13:28 UTC (rev 41356)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,11 +7,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> jQuery( document ).ready( function( $ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        var tbWindow,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $focusedBefore,
</del><span class="cx" style="display: block; padding: 0 10px">                 $iframeBody,
</span><span class="cx" style="display: block; padding: 0 10px">                $tabbables,
</span><span class="cx" style="display: block; padding: 0 10px">                $firstTabbable,
</span><span class="cx" style="display: block; padding: 0 10px">                $lastTabbable,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $focusedBefore = $(),
</ins><span class="cx" style="display: block; padding: 0 10px">                 $uploadViewToggle = $( '.upload-view-toggle' ),
</span><span class="cx" style="display: block; padding: 0 10px">                $wrap = $ ( '.wrap' ),
</span><span class="cx" style="display: block; padding: 0 10px">                $body = $( document.body );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,6 +58,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        $body
</span><span class="cx" style="display: block; padding: 0 10px">                .on( 'thickbox:iframe:loaded', tbWindow, function() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        /*
+                        * Return if it's not the modal with the plugin details iframe. Other
+                        * thickbox instances might want to load an iframe with content from
+                        * an external domain. Avoid to access the iframe contents when we're
+                        * not sure the iframe loads from the same domain.
+                        */
+                       if ( ! tbWindow.hasClass( 'plugin-details-modal' ) ) {
+                               return;
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         iframeLoaded();
</span><span class="cx" style="display: block; padding: 0 10px">                })
</span><span class="cx" style="display: block; padding: 0 10px">                .on( 'thickbox:removed', function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,11 +159,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                tb_click.call(this);
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Set ARIA role and ARIA label.
-               tbWindow.attr({
-                       'role': 'dialog',
-                       'aria-label': plugininstallL10n.plugin_modal_label
-               });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Set ARIA role, ARIA label, and add a CSS class.
+               tbWindow
+                       .attr({
+                               'role': 'dialog',
+                               'aria-label': plugininstallL10n.plugin_modal_label
+                       })
+                       .addClass( 'plugin-details-modal' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Set title attribute on the iframe.
</span><span class="cx" style="display: block; padding: 0 10px">                tbWindow.find( '#TB_iframeContent' ).attr( 'title', title );
</span></span></pre></div>
<a id="trunksrcwpincludesjsthickboxthickboxcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/thickbox/thickbox.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/thickbox/thickbox.css    2017-09-09 13:52:46 UTC (rev 41355)
+++ trunk/src/wp-includes/js/thickbox/thickbox.css      2017-09-09 14:13:28 UTC (rev 41356)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,7 +94,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #TB_load {
</span><span class="cx" style="display: block; padding: 0 10px">        position: fixed;
</span><span class="cx" style="display: block; padding: 0 10px">        display: none;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        z-index: 103;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ z-index: 100050;
</ins><span class="cx" style="display: block; padding: 0 10px">         top: 50%;
</span><span class="cx" style="display: block; padding: 0 10px">        left: 50%;
</span><span class="cx" style="display: block; padding: 0 10px">        background-color: #E8E8E8;
</span></span></pre>
</div>
</div>

</body>
</html>