Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: MessageDialog: Add Firefox hack for scrollbars when sizing 
dialogs
......................................................................

MessageDialog: Add Firefox hack for scrollbars when sizing dialogs

Firefox sometimes produces a scrollbar when the element doesn't need one
(http://i.imgur.com/8mpcLvw.png instead of http://i.imgur.com/gfJnz2J.png).
Temporarily killing it (with overflow: hidden), forcing reflow and then
restoring previous overflow value fixes it.

Bug: T72061
Change-Id: I8430cf6fc4da3c0f8fb4ab5bd6d2847834992d9b
---
M src/dialogs/MessageDialog.js
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/82/175782/1

diff --git a/src/dialogs/MessageDialog.js b/src/dialogs/MessageDialog.js
index ab51496..9886038 100644
--- a/src/dialogs/MessageDialog.js
+++ b/src/dialogs/MessageDialog.js
@@ -141,6 +141,25 @@
 /**
  * @inheritdoc
  */
+OO.ui.MessageDialog.prototype.setDimensions = function ( dim ) {
+       var $scrollable = this.container.$element;
+       OO.ui.MessageDialog.super.prototype.setDimensions.call( this, dim );
+
+       // Firefox hack:
+       // Twiddle the overflow property, otherwise an unnecessary scrollbar 
may be produced.
+       // Need to do it after transition completes (250ms), add 50ms just in 
case.
+       setTimeout( function () {
+               $scrollable.css( 'overflow', 'hidden' );
+               $scrollable.height(); // Force reflow
+               $scrollable.css( 'overflow', '' );
+       }, 300 );
+
+       return this;
+};
+
+/**
+ * @inheritdoc
+ */
 OO.ui.MessageDialog.prototype.initialize = function () {
        // Parent method
        OO.ui.MessageDialog.super.prototype.initialize.call( this );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8430cf6fc4da3c0f8fb4ab5bd6d2847834992d9b
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to