From be99866ffaf40e4d46a3191fae7160a9c333382f Mon Sep 17 00:00:00 2001 From: jlukic Date: Sun, 23 Nov 2014 23:53:22 -0500 Subject: [PATCH] Leaving search midway will now preserve filtered results, fixed issue with IE11 when all results filtered --- src/definitions/modules/dropdown.js | 11 +++++++++-- src/themes/default/modules/dropdown.variables | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 030f76de3..39b1915cc 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -203,7 +203,6 @@ $.fn.dropdown = function(parameters) { if( module.is.active() ) { module.debug('Hiding dropdown'); module.animate.hide(function() { - module.remove.filteredItem(); module.remove.visible(); }); $.proxy(settings.onHide, element)(); @@ -264,6 +263,7 @@ $.fn.dropdown = function(parameters) { .on('mousedown' + eventNamespace, selector.menu, module.event.menu.activate) .on('mouseup' + eventNamespace, selector.menu, module.event.menu.deactivate) .on('focus' + eventNamespace, selector.search, module.event.searchFocus) + .on('click' + eventNamespace, selector.search, module.show) .on('blur' + eventNamespace, selector.search, module.event.searchBlur) ; } @@ -369,6 +369,9 @@ $.fn.dropdown = function(parameters) { .eq(0) .addClass(className.selected) ; + if($filteredItems.size() == $item.size()) { + module.hide(); + } }, focusSearch: function() { @@ -572,7 +575,8 @@ $.fn.dropdown = function(parameters) { ? text.toLowerCase() : text, callback = function() { - $search.val(''); + module.remove.searchTerm(); + module.remove.filteredItem(); module.determine.selectAction(text, value); $.proxy(settings.onChange, element)(value, text, $choice); }, @@ -957,6 +961,9 @@ $.fn.dropdown = function(parameters) { filteredItem: function() { $item.removeClass(className.filtered); }, + searchTerm: function() { + $search.val(''); + }, selectedItem: function() { $item.removeClass(className.selected); }, diff --git a/src/themes/default/modules/dropdown.variables b/src/themes/default/modules/dropdown.variables index c6e5406f1..909367cc7 100644 --- a/src/themes/default/modules/dropdown.variables +++ b/src/themes/default/modules/dropdown.variables @@ -169,7 +169,7 @@ @selectionVisibleIconOpacity: 1; /* Search */ -@searchMinWidth: auto; +@searchMinWidth: ''; /* Search Selection */ @searchSelectionLineHeight: 1.2em;