Browse files

[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...
1 parent 356f5a4 commit d698ca42257c0887ded2b2aa41426a94fea5d9ae @gabrielschulhof gabrielschulhof committed Oct 25, 2012
Showing with 14 additions and 10 deletions.
  1. +14 −10 js/widgets/popup.js
View
24 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;
}
},

0 comments on commit d698ca4

Please sign in to comment.