diff --git a/misc/autocomplete.js b/misc/autocomplete.js --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -112,6 +114,7 @@ */ Drupal.jsAC.prototype.select = function (node) { this.input.value = $(node).data('autocompleteValue'); + $(this.input).trigger('autocompleteSelect', [node]); }; /** @@ -165,7 +168,7 @@ Drupal.jsAC.prototype.hidePopup = function (keycode) { // Select item if the right key or mousebutton was pressed. if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { - this.input.value = $(this.selected).data('autocompleteValue'); + this.select(this.selected); } // Hide popup. var popup = this.popup; @@ -218,7 +221,7 @@ for (key in matches) { $('
  • ') .html($('
    ').html(matches[key])) - .mousedown(function () { ac.select(this); }) + .mousedown(function () { ac.hidePopup(this); }) .mouseover(function () { ac.highlight(this); }) .mouseout(function () { ac.unhighlight(this); }) .data('autocompleteValue', key)