Browse Source

Fix hybrid <select> init

pull/2755/merge
Jack Lukic 9 years ago
parent
commit
223bd3b0fd
2 changed files with 14 additions and 7 deletions
  1. 1
      RELEASE-NOTES.md
  2. 20
      src/definitions/modules/dropdown.js

1
RELEASE-NOTES.md

@ -45,6 +45,7 @@
- **Menu** - Added `flex: 0 0 auto` to menu item to make sure menu do not collapse text content to reduce space - **Menu** - Added `flex: 0 0 auto` to menu item to make sure menu do not collapse text content to reduce space
- **Menu** - Fix text align on `dropdown item` inside `icon menu` - **Menu** - Fix text align on `dropdown item` inside `icon menu`
- **Menu** - Fixed issue with `labeled input` text inside menu not appearing vertically centered - **Menu** - Fixed issue with `labeled input` text inside menu not appearing vertically centered
- **Menu** - Fixed hybrid initialization not creating `menu` correctly. Fixed docs example of hybrid `<select>` initialization
**[Merged PR](https://github.com/Semantic-Org/Semantic-UI/issues?q=is%3Aissue+milestone%3A2.1.0+is%3Aclosed)** **[Merged PR](https://github.com/Semantic-Org/Semantic-UI/issues?q=is%3Aissue+milestone%3A2.1.0+is%3Aclosed)**

20
src/definitions/modules/dropdown.js

@ -211,6 +211,12 @@ $.fn.dropdown = function(parameters) {
}); });
} }
}, },
menu: function() {
$menu = $('<div />')
.addClass(className.menu)
.appendTo($module)
;
}
}, },
search: function(query) { search: function(query) {
@ -268,6 +274,9 @@ $.fn.dropdown = function(parameters) {
module.setup.select(); module.setup.select();
module.setup.returnedObject(); module.setup.returnedObject();
} }
if( !module.has.menu() ) {
module.create.menu();
}
if( module.is.search() && !module.has.search() ) { if( module.is.search() && !module.has.search() ) {
module.verbose('Adding search input'); module.verbose('Adding search input');
$search = $('<input />') $search = $('<input />')
@ -278,12 +287,6 @@ $.fn.dropdown = function(parameters) {
if(settings.allowTab) { if(settings.allowTab) {
module.set.tabbable(); module.set.tabbable();
} }
if($menu.length === 0) {
$menu = $('<div />')
.addClass(className.menu)
.appendTo($module)
;
}
}, },
select: function() { select: function() {
var var
@ -297,7 +300,10 @@ $.fn.dropdown = function(parameters) {
if($input.parent(selector.dropdown).length > 0) { if($input.parent(selector.dropdown).length > 0) {
module.debug('UI dropdown already exists. Creating dropdown menu only'); module.debug('UI dropdown already exists. Creating dropdown menu only');
$module = $input.closest(selector.dropdown); $module = $input.closest(selector.dropdown);
$menu = $module.children(selector.menu);
if( !module.has.menu() ) {
module.create.menu();
}
$menu = $module.children(selector.menu);
module.setup.menu(selectValues); module.setup.menu(selectValues);
} }
else { else {

Loading…
Cancel
Save