From eb51187ef6d2df0bcdf06e7cd843b31a0a8faede Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 11 Oct 2014 22:26:27 +0200 Subject: [PATCH] Fixed autocomplete inputs weren't clickable --- public_html/css/forms.css | 1 + public_html/js/Controls/AutoCompleteInput.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/public_html/css/forms.css b/public_html/css/forms.css index 89bfddcc..9eaf6412 100644 --- a/public_html/css/forms.css +++ b/public_html/css/forms.css @@ -242,6 +242,7 @@ input[type=checkbox]:checked + label::before { .autocomplete li { margin: 0; padding: 0.1em 0.5em !important; + cursor: pointer; } .autocomplete li.active { diff --git a/public_html/js/Controls/AutoCompleteInput.js b/public_html/js/Controls/AutoCompleteInput.js index 26a027da..b74d2ddc 100644 --- a/public_html/js/Controls/AutoCompleteInput.js +++ b/public_html/js/Controls/AutoCompleteInput.js @@ -198,10 +198,21 @@ App.Controls.AutoCompleteInput = function($input) { } $list.empty(); - _.each(results, function(resultItem) { + _.each(results, function(resultItem, resultIndex) { var $listItem = jQuery('
  • '); $listItem.text(resultItem[1]); $listItem.attr('data-key', resultItem[0]); + $listItem.hover(function(e) { + e.preventDefault(); + activeResult = resultIndex; + refreshActiveResult(); + }); + $listItem.mousedown(function(e) { + e.preventDefault(); + activeResult = resultIndex; + applyAutocomplete(); + hide(); + }); $list.append($listItem); }); refreshActiveResult();