Hello Esanders, Catrope, Petar.petkovic, jenkins-bot, VolkerE, Jforrester,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/403755
to review the following change.
Change subject: PopupToolGroup: Revert "Fix popup direction changing..."
......................................................................
PopupToolGroup: Revert "Fix popup direction changing..."
PopupToolGroup does not mix in FloatableElement. The fix was unnecessary
and actually broke it.
This partially reverts commit a3dfbe7ab046711497cfb07eb6393fff77b855f3.
Bug: T184665
Change-Id: I99caad7babd089c60aae9079ba1a9de749c04709
---
M src/mixins/FloatableElement.js
M src/toolgroups/PopupToolGroup.js
M src/widgets/MenuSelectWidget.js
M src/widgets/PopupWidget.js
4 files changed, 9 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/55/403755/1
diff --git a/src/mixins/FloatableElement.js b/src/mixins/FloatableElement.js
index bbf2cf1..c5b6da3 100644
--- a/src/mixins/FloatableElement.js
+++ b/src/mixins/FloatableElement.js
@@ -41,7 +41,6 @@
this.$floatableContainer = null;
this.$floatableWindow = null;
this.$floatableClosestScrollable = null;
- this.floatableOutOfView = false;
this.onFloatableScrollHandler = this.position.bind( this );
this.onFloatableWindowResizeHandler = this.position.bind( this );
@@ -246,15 +245,6 @@
};
/**
- * Check if the floatable is hidden to the user because it was offscreen.
- *
- * @return {boolean} Floatable is out of view
- */
-OO.ui.mixin.FloatableElement.prototype.isFloatableOutOfView = function () {
- return this.floatableOutOfView;
-};
-
-/**
* Position the floatable below its container.
*
* This should only be done when both of them are attached to the DOM and
visible.
@@ -280,8 +270,7 @@
return this;
}
- this.floatableOutOfView = this.hideWhenOutOfView &&
!this.isElementInViewport( this.$floatableContainer,
this.$floatableClosestScrollable );
- if ( this.floatableOutOfView ) {
+ if ( this.hideWhenOutOfView && !this.isElementInViewport(
this.$floatableContainer, this.$floatableClosestScrollable ) ) {
this.$floatable.addClass( 'oo-ui-element-hidden' );
return this;
} else {
diff --git a/src/toolgroups/PopupToolGroup.js b/src/toolgroups/PopupToolGroup.js
index 3adf7f3..96345dd 100644
--- a/src/toolgroups/PopupToolGroup.js
+++ b/src/toolgroups/PopupToolGroup.js
@@ -211,7 +211,7 @@
this.$element.addClass( 'oo-ui-popupToolGroup-active
oo-ui-popupToolGroup-left' );
this.setFlags( { progressive: true } );
this.toggleClipping( true );
- if ( this.isClippedHorizontally() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedHorizontally() ) {
// Anchoring to the left caused the popup to
clip, so anchor it to the right instead
this.toggleClipping( false );
this.$element
@@ -219,7 +219,7 @@
.addClass( 'oo-ui-popupToolGroup-right'
);
this.toggleClipping( true );
}
- if ( this.isClippedHorizontally() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedHorizontally() ) {
// Anchoring to the right also caused the popup
to clip, so just make it fill the container
containerWidth =
this.$clippableScrollableContainer.width();
containerLeft =
this.$clippableScrollableContainer[ 0 ] === document.documentElement ?
diff --git a/src/widgets/MenuSelectWidget.js b/src/widgets/MenuSelectWidget.js
index 5beb7b0..a11d3a2 100644
--- a/src/widgets/MenuSelectWidget.js
+++ b/src/widgets/MenuSelectWidget.js
@@ -357,11 +357,11 @@
this.togglePositioning( !!this.$floatableContainer );
this.toggleClipping( true );
- if ( this.isClippedVertically() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedVertically() ) {
// If opening the menu downwards causes it to
be clipped, flip it to open upwards instead
belowHeight = this.$element.height();
this.setVerticalPosition( 'above' );
- if ( this.isClippedVertically() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedVertically() ) {
// If opening upwards also causes it to
be clipped, flip it to open in whichever direction
// we have more space
aboveHeight = this.$element.height();
diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index 6711cbc..d0ca042 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -340,13 +340,13 @@
if ( this.autoFlip ) {
if ( this.popupPosition === 'above' ||
this.popupPosition === 'below' ) {
- if ( this.isClippedVertically() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedVertically() ) {
// If opening the popup in the
normal direction causes it to be clipped, open
// in the opposite one instead
normalHeight =
this.$element.height();
this.isAutoFlipped =
!this.isAutoFlipped;
this.position();
- if ( this.isClippedVertically()
|| this.isFloatableOutOfView() ) {
+ if ( this.isClippedVertically()
) {
// If that also causes
it to be clipped, open in whichever direction
// we have more space
oppositeHeight =
this.$element.height();
@@ -358,7 +358,7 @@
}
}
if ( this.popupPosition === 'before' ||
this.popupPosition === 'after' ) {
- if ( this.isClippedHorizontally() ||
this.isFloatableOutOfView() ) {
+ if ( this.isClippedHorizontally() ) {
// If opening the popup in the
normal direction causes it to be clipped, open
// in the opposite one instead
normalWidth =
this.$element.width();
@@ -368,7 +368,7 @@
this.toggleClipping( false );
this.position();
this.toggleClipping( true );
- if (
this.isClippedHorizontally() || this.isFloatableOutOfView() ) {
+ if (
this.isClippedHorizontally() ) {
// If that also causes
it to be clipped, open in whichever direction
// we have more space
oppositeWidth =
this.$element.width();
--
To view, visit https://gerrit.wikimedia.org/r/403755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99caad7babd089c60aae9079ba1a9de749c04709
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Petar.petkovic <[email protected]>
Gerrit-Reviewer: VolkerE <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits