Skip to content
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 20c2fa1 commit e2f3ff9965cd84027cb035d878f465fd40a5e574 @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
@@ -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;
@@ -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;
}
},

0 comments on commit e2f3ff9

Please sign in to comment.
Something went wrong with that request. Please try again.