Skip to content

Commit b2ae31b

Browse files
authored
fix(dropdown): columnar dropdowns on raw divs
When a dropdown was created out of prepared divs, the column menus were not working. That's because the previous approach was using display:inline-block which breaks when the sourcecode contains linebreaks. (Which a well formatted HTML source always has) It was working when a select tag was converted, but only because the generated HTML did not contain any whitespace This PR now switches to flexbox for column menus which does not care about linebreaks :) As the transition does block by default we had to teach dropdown to use flex when column menus are used
1 parent 4cff0d5 commit b2ae31b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/definitions/modules/dropdown.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3533,9 +3533,12 @@ $.fn.dropdown = function(parameters) {
35333533
module.set.scrollPosition(module.get.selectedItem(), true);
35343534
}
35353535
if( module.is.hidden($currentMenu) || module.is.animating($currentMenu) ) {
3536+
var displayType = $module.hasClass('column') ? 'flex' : false;
35363537
if(transition == 'none') {
35373538
start();
3538-
$currentMenu.transition('show');
3539+
$currentMenu.transition({
3540+
displayType: displayType
3541+
}).transition('show');
35393542
callback.call(element);
35403543
}
35413544
else if($.fn.transition !== undefined && $module.transition('is supported')) {
@@ -3547,6 +3550,7 @@ $.fn.dropdown = function(parameters) {
35473550
duration : settings.duration,
35483551
queue : true,
35493552
onStart : start,
3553+
displayType: displayType,
35503554
onComplete : function() {
35513555
callback.call(element);
35523556
}

src/definitions/modules/dropdown.less

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,20 +1261,19 @@ select.ui.dropdown {
12611261
/*--------------
12621262
Columnar
12631263
---------------*/
1264+
.ui.column.dropdown > .menu {
1265+
flex-wrap:wrap;
1266+
}
12641267
.ui.dropdown[class*="two column"] > .menu > .item {
1265-
display: inline-block;
12661268
width: 50%;
12671269
}
12681270
.ui.dropdown[class*="three column"] > .menu > .item {
1269-
display: inline-block;
12701271
width: 33%;
12711272
}
12721273
.ui.dropdown[class*="four column"] > .menu > .item {
1273-
display: inline-block;
12741274
width: 25%;
12751275
}
12761276
.ui.dropdown[class*="five column"] > .menu > .item {
1277-
display: inline-block;
12781277
width: 20%;
12791278
}
12801279

0 commit comments

Comments
 (0)