/*!
- * OOUI v0.25.3
+ * OOUI v0.27.0
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2018 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2018-03-07T06:52:35Z
+ * Date: 2018-05-09T00:44:45Z
*/
( function ( OO ) {
* @param {jQuery.Event} e Window resize event
*/
OO.ui.WindowManager.prototype.afterWindowResize = function () {
+ var currentFocusedElement = document.activeElement;
if ( this.currentWindow ) {
this.updateWindowSize( this.currentWindow );
+
+ // Restore focus to the original element if it has changed.
+ // When a layout change is made on resize inputs lose focus
+ // on Android (Chrome and Firefox). See T162127.
+ if ( currentFocusedElement !== document.activeElement ) {
+ currentFocusedElement.focus();
+ }
}
};
this.detachActions();
if ( !this.isClosing() ) {
this.attachActions();
+ if ( !this.isOpening() ) {
+ // If the dialog is currently opening, this will be called automatically soon.
+ this.updateSize();
+ }
}
};
/* Methods */
-/**
- * @inheritdoc
- */
-OO.ui.MessageDialog.prototype.setManager = function ( manager ) {
- OO.ui.MessageDialog.parent.prototype.setManager.call( this, manager );
-
- // Events
- this.manager.connect( this, {
- resize: 'onResize'
- } );
-
- return this;
-};
-
-/**
- * Handle window resized events.
- *
- * @private
- */
-OO.ui.MessageDialog.prototype.onResize = function () {
- var dialog = this;
- dialog.fitActions();
- // Wait for CSS transition to finish and do it again :(
- setTimeout( function () {
- dialog.fitActions();
- }, 300 );
-};
-
/**
* Toggle action layout between vertical and horizontal.
*
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.setDimensions = function ( dim ) {
- var $scrollable = this.container.$element;
+ var
+ dialog = this,
+ $scrollable = this.container.$element;
OO.ui.MessageDialog.parent.prototype.setDimensions.call( this, dim );
// Twiddle the overflow property, otherwise an unnecessary scrollbar will be produced.
$scrollable[ 0 ].style.overflow = oldOverflow;
}, 300 );
+ dialog.fitActions();
+ // Wait for CSS transition to finish and do it again :(
+ setTimeout( function () {
+ dialog.fitActions();
+ }, 300 );
+
return this;
};
this.$actions.append( special.primary.$element );
special.primary.toggleFramed( false );
}
-
- if ( !this.isOpening() ) {
- // If the dialog is currently opening, this will be called automatically soon.
- // This also calls #fitActions.
- this.updateSize();
- }
};
/**
if ( special.safe ) {
this.$safeActions.append( special.safe.$element );
}
-
- this.fitLabel();
- this.$body.css( 'bottom', this.$foot.outerHeight( true ) );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.setDimensions = function () {
+ var dialog = this;
+
// Parent method
OO.ui.ProcessDialog.parent.prototype.setDimensions.apply( this, arguments );
this.fitLabel();
+
+ // If there are many actions, they might be shown on multiple lines. Their layout can change when
+ // resizing the dialog and when changing the actions. Adjust the height of the footer to fit them.
+ dialog.$body.css( 'bottom', dialog.$foot.outerHeight( true ) );
+ // Wait for CSS transition to finish and do it again :(
+ setTimeout( function () {
+ dialog.$body.css( 'bottom', dialog.$foot.outerHeight( true ) );
+ }, 300 );
};
/**