Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/230128
Change subject: Handle popup position on very narrow screens
......................................................................
Handle popup position on very narrow screens
If the popup clips when positioned left *and* right, then
resort to making it fill the width of the container.
Bug: T108344
Change-Id: I6a949e8f2f91cc630e1d1d55f2a9c9b0fb7a8563
---
M src/toolgroups/PopupToolGroup.js
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/28/230128/1
diff --git a/src/toolgroups/PopupToolGroup.js b/src/toolgroups/PopupToolGroup.js
index 19f8bbb..16844f1 100644
--- a/src/toolgroups/PopupToolGroup.js
+++ b/src/toolgroups/PopupToolGroup.js
@@ -163,6 +163,7 @@
* deactivation.
*/
OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
+ var containerWidth, containerLeft;
value = !!value;
if ( this.active !== value ) {
this.active = value;
@@ -170,6 +171,7 @@
this.getElementDocument().addEventListener( 'mouseup',
this.onBlurHandler, true );
this.getElementDocument().addEventListener( 'keyup',
this.onBlurHandler, true );
+ this.$clippable.css( 'left', '' );
// Try anchoring the popup to the left first
this.$element.addClass( 'oo-ui-popupToolGroup-active
oo-ui-popupToolGroup-left' );
this.toggleClipping( true );
@@ -181,6 +183,19 @@
.addClass( 'oo-ui-popupToolGroup-right'
);
this.toggleClipping( true );
}
+ if ( this.isClippedHorizontally() ) {
+ // Anchoring to the right also caused the popup
to clip, so just make it fill the container
+ containerWidth =
this.$clippableContainer.width();
+ containerLeft =
this.$clippableContainer.offset().left;
+
+ this.toggleClipping( false );
+ this.$element.removeClass(
'oo-ui-popupToolGroup-right' );
+
+ this.$clippable.css( {
+ left: -( this.$element.offset().left -
containerLeft ),
+ width: containerWidth
+ } );
+ }
} else {
this.getElementDocument().removeEventListener(
'mouseup', this.onBlurHandler, true );
this.getElementDocument().removeEventListener( 'keyup',
this.onBlurHandler, true );
--
To view, visit https://gerrit.wikimedia.org/r/230128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a949e8f2f91cc630e1d1d55f2a9c9b0fb7a8563
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits