Browse Source

Fix issue with search dropdown not working on menu click

pull/1191/head
jlukic 10 years ago
parent
commit
77e19fe64b
1 changed files with 18 additions and 18 deletions
  1. 36
      src/definitions/modules/dropdown.js

36
src/definitions/modules/dropdown.js

@ -77,9 +77,10 @@ $.fn.dropdown = function(parameters) {
if(hasTouch) { if(hasTouch) {
module.bind.touchEvents(); module.bind.touchEvents();
} }
module.observeChanges();
module.bind.mouseEvents(); module.bind.mouseEvents();
module.bind.keyboardEvents(); module.bind.keyboardEvents();
module.observeChanges();
module.instantiate(); module.instantiate();
}, },
@ -259,20 +260,6 @@ $.fn.dropdown = function(parameters) {
.on(module.get.inputEvent(), selector.search, module.event.input) .on(module.get.inputEvent(), selector.search, module.event.input)
; ;
} }
if( module.is.searchSelection() ) {
$module
.on('focus' + eventNamespace, selector.search, module.event.searchFocus)
.on('blur' + eventNamespace, selector.search, module.event.searchBlur)
;
}
else {
$module
.on('mousedown', module.event.mousedown)
.on('mouseup', module.event.mouseup)
.on('focus' + eventNamespace, module.event.focus)
.on('blur' + eventNamespace, module.event.blur)
;
}
}, },
touchEvents: function() { touchEvents: function() {
module.debug('Touch device detected binding touch events'); module.debug('Touch device detected binding touch events');
@ -288,7 +275,13 @@ $.fn.dropdown = function(parameters) {
}, },
mouseEvents: function() { mouseEvents: function() {
module.verbose('Mouse detected binding mouse events'); module.verbose('Mouse detected binding mouse events');
if( !module.is.searchSelection() ) {
if( module.is.searchSelection() ) {
$module
.on('focus' + eventNamespace, selector.search, module.event.searchFocus)
.on('blur' + eventNamespace, selector.search, module.event.searchBlur)
;
}
else {
if(settings.on == 'click') { if(settings.on == 'click') {
$module $module
.on('click' + eventNamespace, module.event.test.toggle) .on('click' + eventNamespace, module.event.test.toggle)
@ -305,6 +298,12 @@ $.fn.dropdown = function(parameters) {
.on(settings.on + eventNamespace, module.toggle) .on(settings.on + eventNamespace, module.toggle)
; ;
} }
$module
.on('mousedown', module.event.mousedown)
.on('mouseup', module.event.mouseup)
.on('focus' + eventNamespace, module.event.focus)
.on('blur' + eventNamespace, module.event.blur)
;
} }
$module $module
.on('mouseenter' + eventNamespace, selector.item, module.event.item.mouseenter) .on('mouseenter' + eventNamespace, selector.item, module.event.item.mouseenter)
@ -409,7 +408,8 @@ $.fn.dropdown = function(parameters) {
module.show(); module.show();
}, },
searchBlur: function(event) { searchBlur: function(event) {
module.hide();
// give enough time for events to bubble
setTimeout(module.hide, 50);
}, },
input: function(event) { input: function(event) {
var var
@ -1338,7 +1338,7 @@ $.fn.dropdown.settings = {
name : 'Dropdown', name : 'Dropdown',
namespace : 'dropdown', namespace : 'dropdown',
debug : false,
debug : true,
verbose : true, verbose : true,
performance : true, performance : true,

Loading…
Cancel
Save