Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[popup] Initiate resize expectation during orientationchange -- Fixes #…
…5153

Also, do not rapid-hide the popup during orientationchange, so if an orientationchange happens without any subsequent resize events (such as a 180 degree rotation), the popup doesn't blink out and in
  • Loading branch information
Gabriel Schulhof committed Oct 25, 2012
1 parent 20c2fa1 commit e2f3ff9
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions js/widgets/popup.js
Expand Up @@ -114,11 +114,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;
Expand All @@ -132,17 +134,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;
}
},
Expand Down

0 comments on commit e2f3ff9

Please sign in to comment.