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

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

Change subject: DropdownWidget: Add $overlay config option
......................................................................

DropdownWidget: Add $overlay config option

Very similar to ComboBoxWidget's.

Bug: T108949
Change-Id: Icbf093b36daadd2133a7935a9d83b1d6ddd6ab55
---
M src/widgets/DropdownWidget.js
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/70/231470/1

diff --git a/src/widgets/DropdownWidget.js b/src/widgets/DropdownWidget.js
index 58cdc20..013737f 100644
--- a/src/widgets/DropdownWidget.js
+++ b/src/widgets/DropdownWidget.js
@@ -44,7 +44,10 @@
  *
  * @constructor
  * @param {Object} [config] Configuration options
- * @cfg {Object} [menu] Configuration options to pass to menu widget
+ * @cfg {Object} [menu] Configuration options to pass to {@link 
OO.ui.FloatingMenuSelectWidget menu select widget}
+ * @cfg {jQuery} [$overlay] Render the menu into a separate layer. This 
configuration is useful in cases where
+ *  the expanded menu is larger than its containing `<div>`. The specified 
overlay layer is usually on top of the
+ *  containing `<div>` and has a larger area. By default, the menu uses 
relative positioning.
  */
 OO.ui.DropdownWidget = function OoUiDropdownWidget( config ) {
        // Configuration initialization
@@ -55,6 +58,7 @@
 
        // Properties (must be set before TabIndexedElement constructor call)
        this.$handle = this.$( '<span>' );
+       this.$overlay = config.$overlay || this.$element;
 
        // Mixin constructors
        OO.ui.mixin.IconElement.call( this, config );
@@ -64,7 +68,10 @@
        OO.ui.mixin.TabIndexedElement.call( this, $.extend( {}, config, { 
$tabIndexed: this.$handle } ) );
 
        // Properties
-       this.menu = new OO.ui.MenuSelectWidget( $.extend( { widget: this }, 
config.menu ) );
+       this.menu = new OO.ui.FloatingMenuSelectWidget( $.extend( {
+               widget: this,
+               $container: this.$element
+       }, config.menu ) );
 
        // Events
        this.$handle.on( {
@@ -79,7 +86,8 @@
                .append( this.$icon, this.$label, this.$indicator );
        this.$element
                .addClass( 'oo-ui-dropdownWidget' )
-               .append( this.$handle, this.menu.$element );
+               .append( this.$handle );
+       this.$overlay.append( this.menu.$element );
 };
 
 /* Setup */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbf093b36daadd2133a7935a9d83b1d6ddd6ab55
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to