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

Commit e2f3ff9

Browse files
author
Gabriel Schulhof
committed
[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
1 parent 20c2fa1 commit e2f3ff9

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

js/widgets/popup.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ define( [ "jquery",
114114
_resizeTimeout: function() {
115115
if ( this._isOpen ) {
116116
if ( !this._maybeRefreshTimeout() ) {
117-
// effectively rapid-open the popup while leaving the screen intact
118-
this._trigger( "beforeposition" );
119-
this._ui.container
120-
.removeClass( "ui-selectmenu-hidden" )
121-
.offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) );
117+
if ( this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) {
118+
// effectively rapid-open the popup while leaving the screen intact
119+
this._trigger( "beforeposition" );
120+
this._ui.container
121+
.removeClass( "ui-selectmenu-hidden" )
122+
.offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) );
123+
}
122124

123125
this._resizeScreen();
124126
this._resizeData = null;
@@ -132,17 +134,19 @@ define( [ "jquery",
132134

133135
_handleWindowResize: function( e ) {
134136
if ( this._isOpen ) {
137+
if ( !this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) {
138+
// effectively rapid-close the popup while leaving the screen intact
139+
this._ui.container
140+
.addClass( "ui-selectmenu-hidden" )
141+
.removeAttr( "style" );
142+
}
135143
this._maybeRefreshTimeout();
136144
}
137145
},
138146

139147
_handleWindowOrientationchange: function( e ) {
140148
if ( !this._orientationchangeInProgress && this._isOpen ) {
141-
// effectively rapid-close the popup while leaving the screen intact
142-
this._ui.container
143-
.addClass( "ui-selectmenu-hidden" )
144-
.removeAttr( "style" );
145-
149+
this._maybeRefreshTimeout();
146150
this._orientationchangeInProgress = true;
147151
}
148152
},

0 commit comments

Comments
 (0)