diff --git a/js/widgets/popup.js b/js/widgets/popup.js index d07b645a7df..23ce7f26ccf 100644 --- a/js/widgets/popup.js +++ b/js/widgets/popup.js @@ -111,11 +111,13 @@ define( [ "jquery", _resizeTimeout: function() { if ( this._isOpen ) { if ( !this._maybeRefreshTimeout() ) { - // effectively rapid-open the popup while leaving the screen intact - this._trigger( "beforeposition" ); - this._ui.container - .removeClass( "ui-selectmenu-hidden" ) - .offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) ); + if ( this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) { + // effectively rapid-open the popup while leaving the screen intact + this._trigger( "beforeposition" ); + this._ui.container + .removeClass( "ui-selectmenu-hidden" ) + .offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) ); + } this._resizeScreen(); this._resizeData = null; @@ -129,17 +131,19 @@ define( [ "jquery", _handleWindowResize: function( e ) { if ( this._isOpen ) { + if ( !this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) { + // effectively rapid-close the popup while leaving the screen intact + this._ui.container + .addClass( "ui-selectmenu-hidden" ) + .removeAttr( "style" ); + } this._maybeRefreshTimeout(); } }, _handleWindowOrientationchange: function( e ) { if ( !this._orientationchangeInProgress && this._isOpen ) { - // effectively rapid-close the popup while leaving the screen intact - this._ui.container - .addClass( "ui-selectmenu-hidden" ) - .removeAttr( "style" ); - + this._maybeRefreshTimeout(); this._orientationchangeInProgress = true; } },