Commit c3773584 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Restore menu content when emptying the search input

parent 44817726
...@@ -18,6 +18,7 @@ class @SearchAutocomplete ...@@ -18,6 +18,7 @@ class @SearchAutocomplete
# Dropdown Element # Dropdown Element
@dropdown = @wrap.find('.dropdown') @dropdown = @wrap.find('.dropdown')
@dropdownContent = @dropdown.find('.dropdown-content')
@locationBadgeEl = @getElement('.search-location-badge') @locationBadgeEl = @getElement('.search-location-badge')
@locationText = @getElement('.location-text') @locationText = @getElement('.location-text')
...@@ -136,6 +137,7 @@ class @SearchAutocomplete ...@@ -136,6 +137,7 @@ class @SearchAutocomplete
if e.currentTarget.value is '' if e.currentTarget.value is ''
@removeLocationBadge() @removeLocationBadge()
@searchInput.focus() @searchInput.focus()
@disableAutocomplete()
when KEYCODE.ESCAPE when KEYCODE.ESCAPE
if @badgePresent() if @badgePresent()
else else
...@@ -239,4 +241,13 @@ class @SearchAutocomplete ...@@ -239,4 +241,13 @@ class @SearchAutocomplete
disableAutocomplete: -> disableAutocomplete: ->
if @autocomplete if @autocomplete
@searchInput.addClass('disabled') @searchInput.addClass('disabled')
@dropdown.removeClass('open')
@restoreMenu()
@autocomplete = false @autocomplete = false
restoreMenu: ->
html = "<ul>
<li><a class='is-focused'>Loading...</a></li>
</ul>"
@dropdownContent.html(html)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment