diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index bdc7ed88a..bf7c548db 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -1296,7 +1296,7 @@ $.fn.dropdown = function(parameters) { hasSelectedItem = ($selectedItem.length > 0), selectedIsSelectable = ($selectedItem.not(selector.unselectable).length > 0), delimiterPressed = (pressedKey == keys.delimiter && settings.allowAdditions && module.is.multiple()), - isAdditionWithoutMenu = (settings.allowAdditions && settings.hideAdditions && (pressedKey == keys.enter || delimiterPressed) && selectedIsSelectable), + isAdditionWithoutMenu = (settings.allowAdditions && settings.hideAdditions && (pressedKey == keys.enter || delimiterPressed)), $nextItem, isSubMenuItem, newIndex @@ -1304,6 +1304,7 @@ $.fn.dropdown = function(parameters) { // allow selection with menu closed if(isAdditionWithoutMenu) { + $selectedItem = $menu.children(selector.addition); module.verbose('Selecting item from keyboard shortcut', $selectedItem); module.event.item.click.call($selectedItem, event); if(module.is.searchSelection()) { @@ -2570,6 +2571,7 @@ $.fn.dropdown = function(parameters) { return; } if(value === '' || alreadyHasValue) { + console.log('removing addition'); $addition.remove(); return; } @@ -2594,6 +2596,7 @@ $.fn.dropdown = function(parameters) { $addition .prependTo($menu) ; + $item.add($addition); module.verbose('Adding item choice to menu corresponding with user choice addition', $addition); } if(!settings.hideAdditions || module.is.allFiltered()) {