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

Commit d698ca4

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 356f5a4 commit d698ca4

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
@@ -111,11 +111,13 @@ define( [ "jquery",
111111
_resizeTimeout: function() {
112112
if ( this._isOpen ) {
113113
if ( !this._maybeRefreshTimeout() ) {
114-
// effectively rapid-open the popup while leaving the screen intact
115-
this._trigger( "beforeposition" );
116-
this._ui.container
117-
.removeClass( "ui-selectmenu-hidden" )
118-
.offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) );
114+
if ( this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) {
115+
// effectively rapid-open the popup while leaving the screen intact
116+
this._trigger( "beforeposition" );
117+
this._ui.container
118+
.removeClass( "ui-selectmenu-hidden" )
119+
.offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) );
120+
}
119121

120122
this._resizeScreen();
121123
this._resizeData = null;
@@ -129,17 +131,19 @@ define( [ "jquery",
129131

130132
_handleWindowResize: function( e ) {
131133
if ( this._isOpen ) {
134+
if ( !this._ui.container.hasClass( "ui-selectmenu-hidden" ) ) {
135+
// effectively rapid-close the popup while leaving the screen intact
136+
this._ui.container
137+
.addClass( "ui-selectmenu-hidden" )
138+
.removeAttr( "style" );
139+
}
132140
this._maybeRefreshTimeout();
133141
}
134142
},
135143

136144
_handleWindowOrientationchange: function( e ) {
137145
if ( !this._orientationchangeInProgress && this._isOpen ) {
138-
// effectively rapid-close the popup while leaving the screen intact
139-
this._ui.container
140-
.addClass( "ui-selectmenu-hidden" )
141-
.removeAttr( "style" );
142-
146+
this._maybeRefreshTimeout();
143147
this._orientationchangeInProgress = true;
144148
}
145149
},

0 commit comments

Comments
 (0)