Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/201606

Change subject: Correctly position popups in rtl
......................................................................

Correctly position popups in rtl

CSS definitions should not be flipped when we calculate elements'
positions and offsets to position other elements inside them.

Bug: T94783
Change-Id: Iaf15561409b2b61bbf31fe79bf6e340d86f01cbb
---
M src/themes/mediawiki/widgets.less
M src/widgets/PopupWidget.js
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/06/201606/1

diff --git a/src/themes/mediawiki/widgets.less 
b/src/themes/mediawiki/widgets.less
index 659afbd..0400128 100644
--- a/src/themes/mediawiki/widgets.less
+++ b/src/themes/mediawiki/widgets.less
@@ -65,11 +65,13 @@
 .theme-oo-ui-popupButtonWidget () {
        &.oo-ui-buttonElement-frameless > .oo-ui-popupWidget {
                // Compensate for icon being inset
+               /* @noflip */
                left: 1em;
        }
 
        &.oo-ui-buttonElement-framed > .oo-ui-popupWidget {
                // Compensate for icon being inset
+               /* @noflip */
                left: 1.75em;
        }
 }
diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index 59d7035..a2da637 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -285,7 +285,7 @@
  */
 OO.ui.PopupWidget.prototype.updateDimensions = function ( transition ) {
        var popupOffset, originOffset, containerLeft, containerWidth, 
containerRight,
-               popupLeft, popupRight, overlapLeft, overlapRight, anchorWidth,
+               popupLeft, popupRight, overlapLeft, overlapRight, anchorWidth, 
dir,
                widget = this;
 
        if ( !this.$container ) {
@@ -293,6 +293,14 @@
                this.$container = $( 
this.getClosestScrollableElementContainer() );
        }
 
+       // Get the document direction
+       dir = this.$container.css( 'direction' );
+
+       // If we are in RTL, we need to flip the alignment, unless it is
+       if ( dir === 'rtl' ) {
+               this.align = ( { left: 'right', center: 'center', right: 'left' 
} )[ this.align ];
+       }
+
        // Set height and width before measuring things, since it might cause 
our measurements
        // to change (e.g. due to scrollbars appearing or disappearing)
        this.$popup.css( {

-- 
To view, visit https://gerrit.wikimedia.org/r/201606
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf15561409b2b61bbf31fe79bf6e340d86f01cbb
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to