Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174863

Change subject: Revert "Show the modal overlay as soon as openWindow is called"
......................................................................

Revert "Show the modal overlay as soon as openWindow is called"

Because it's triggering a weird bug in Firefox where
characters are typed into one element and key events
are sent to another element. I have no idea why,
but reverting this fixes it for now.

This reverts commit ca6a16f613e186bec05a481e36dff5eb9f70e0e8.

Bug: 73625
Change-Id: I12dbd5919799ed2bf48b321b396d559a78fb7686
---
M src/Window.js
M src/WindowManager.js
M src/styles/WindowManager.less
M src/themes/apex/windows.less
M src/themes/mediawiki/windows.less
5 files changed, 30 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/63/174863/1

diff --git a/src/Window.js b/src/Window.js
index 2c5796d..6c487f0 100644
--- a/src/Window.js
+++ b/src/Window.js
@@ -37,6 +37,7 @@
  * @param {Object} [config] Configuration options
  * @cfg {string} [size] Symbolic name of dialog size, `small`, `medium`, 
`large` or `full`; omit to
  *   use #static-size
+ * @fires initialize
  */
 OO.ui.Window = function OoUiWindow( config ) {
        // Configuration initialization
@@ -418,7 +419,7 @@
  * instead of display.
  *
  * @param {boolean} [show] Make window visible, omit to toggle visibility
- * @fires toggle
+ * @fires visible
  * @chainable
  */
 OO.ui.Window.prototype.toggle = function ( show ) {
@@ -679,7 +680,7 @@
 
        this.getTeardownProcess( data ).execute().done( function () {
                // Force redraw by asking the browser to measure the elements' 
widths
-               win.$element.removeClass( 'oo-ui-window-load 
oo-ui-window-setup' ).width();
+               win.$element.removeClass( 'oo-ui-window-setup' ).width();
                win.$content.removeClass( 'oo-ui-window-content-setup' 
).width();
                win.$element.hide();
                win.visible = false;
@@ -692,9 +693,10 @@
 /**
  * Load the frame contents.
  *
- * Once the iframe's stylesheets are loaded the returned promise will be 
resolved. Calling while
- * loading will return a promise but not trigger a new loading cycle. Calling 
after loading is
- * complete will return a promise that's already been resolved.
+ * Once the iframe's stylesheets are loaded, the `load` event will be emitted 
and the returned
+ * promise will be resolved. Calling while loading will return a promise but 
not trigger a new
+ * loading cycle. Calling after loading is complete will return a promise 
that's already been
+ * resolved.
  *
  * Sounds simple right? Read on...
  *
@@ -723,12 +725,11 @@
  * All this stylesheet injection and polling magic is in #transplantStyles.
  *
  * @return {jQuery.Promise} Promise resolved when loading is complete
+ * @fires load
  */
 OO.ui.Window.prototype.load = function () {
        var sub, doc, loading,
                win = this;
-
-       this.$element.addClass( 'oo-ui-window-load' );
 
        // Non-isolated windows are already "loaded"
        if ( !this.loading && !this.isolated ) {
diff --git a/src/WindowManager.js b/src/WindowManager.js
index 387e372..2d655ea 100644
--- a/src/WindowManager.js
+++ b/src/WindowManager.js
@@ -391,10 +391,13 @@
 
        // Window opening
        if ( opening.state() !== 'rejected' ) {
-               if ( !win.getManager() ) {
+               // Begin loading the window if it's not loading or loaded 
already - may take noticable time
+               // and we want to do this in parallel with any other 
preparatory actions
+               if ( !win.isLoading() && !win.isLoaded() ) {
+                       // Finish initializing the window (must be done after 
manager is attached to DOM)
                        win.setManager( this );
+                       preparing.push( win.load() );
                }
-               preparing.push( win.load() );
 
                if ( this.closing ) {
                        // If a window is currently closing, wait for it to 
complete
diff --git a/src/styles/WindowManager.less b/src/styles/WindowManager.less
index 1263689..5a78c7f 100644
--- a/src/styles/WindowManager.less
+++ b/src/styles/WindowManager.less
@@ -7,7 +7,7 @@
                height: 0;
                overflow: hidden;
 
-               &.oo-ui-window-load {
+               &.oo-ui-window-setup {
                        width: auto;
                        height: auto;
                        top: 0;
@@ -15,29 +15,21 @@
                        bottom: 0;
                        left: 0;
                        padding: 1em;
-               }
 
-               &.oo-ui-window-setup > .oo-ui-window-frame {
-                       position: absolute;
-                       right: 0;
-                       left: 0;
-                       margin: auto;
-                       overflow: hidden;
-                       max-width: 100%;
-                       max-height: 100%;
+                       > .oo-ui-window-frame {
+                               position: absolute;
+                               right: 0;
+                               left: 0;
+                               margin: auto;
+                               overflow: hidden;
+                               max-width: 100%;
+                               max-height: 100%;
 
-                       > iframe {
-                               width: 100%;
-                               height: 100%;
+                               > iframe {
+                                       width: 100%;
+                                       height: 100%;
+                               }
                        }
-               }
-
-               .oo-ui-window-frame {
-                       visibility: hidden;
-               }
-
-               &.oo-ui-window-ready > .oo-ui-window-frame {
-                       visibility: visible;
                }
        }
 
diff --git a/src/themes/apex/windows.less b/src/themes/apex/windows.less
index 4dab86f..a8edbfa 100644
--- a/src/themes/apex/windows.less
+++ b/src/themes/apex/windows.less
@@ -317,11 +317,9 @@
                        .oo-ui-transition(all 250ms ease-in-out);
                }
 
-               &.oo-ui-window-load {
-                       opacity: 1;
-               }
-
                &.oo-ui-window-ready {
+                       opacity: 1;
+
                        > .oo-ui-window-frame  {
                                .oo-ui-transform(scale(1));
                        }
diff --git a/src/themes/mediawiki/windows.less 
b/src/themes/mediawiki/windows.less
index f45216e..84b7dff 100644
--- a/src/themes/mediawiki/windows.less
+++ b/src/themes/mediawiki/windows.less
@@ -310,11 +310,9 @@
                        .oo-ui-transition(all 250ms ease-in-out);
                }
 
-               &.oo-ui-window-load {
-                       opacity: 1;
-               }
-
                &.oo-ui-window-ready {
+                       opacity: 1;
+
                        > .oo-ui-window-frame  {
                                .oo-ui-transform(scale(1));
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/174863
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12dbd5919799ed2bf48b321b396d559a78fb7686
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to