diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-04-06 22:28:15 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-04-06 22:28:15 +0300 |
commit | d1ad639010ecb8619db08f412babc6fb9e23458e (patch) | |
tree | 2a01df513a0daf9a0ceac5b3d779d6fbeb29f6c5 | |
parent | 5f4ce722c0f5fbf9129dddf20de879f00db4a311 (diff) |
Do not fire blur event when clicking a suggestion
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js.coffee | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js.coffee b/app/assets/javascripts/search_autocomplete.js.coffee index 9c85ce1633b..6a7b4ad1db7 100644 --- a/app/assets/javascripts/search_autocomplete.js.coffee +++ b/app/assets/javascripts/search_autocomplete.js.coffee @@ -145,7 +145,10 @@ class @SearchAutocomplete @clearInput.on 'click', @onClearInputClick onDocumentClick: (e) => - if not $.contains(@dropdown[0], e.target) and @isFocused + # If clicking outside the search box + # And search input is not focused + # And we are not clicking inside a suggestion + if not $.contains(@dropdown[0], e.target) and @isFocused and not $(e.target).parents('ul').length @onSearchInputBlur() enableAutocomplete: -> @@ -290,5 +293,4 @@ class @SearchAutocomplete $el.removeClass('is-active') @disableAutocomplete() - @onSearchInputFocus() @searchInput.val('').focus() |