   onDropdownOpen: (e) =>
     @dropdown.dropdown('toggle')
 
+  onSearchInputKeyDown: =>
+    # Saves last length of the entered text
+    @saveTextLength()
+
   onSearchInputKeyUp: (e) =>
     switch e.keyCode
       when KEYCODE.BACKSPACE
-        if e.currentTarget.value is ''
-          @removeLocationBadge()
-          @searchInput.focus()
+        # when trying to remove the location badge
+        if @lastTextLength is 0 and @badgePresent()
+            @removeLocationBadge()
+
+        # When removing the last character and no badge is present
+        if @lastTextLength is 1 and !@badgePresent()
           @disableAutocomplete()
       when KEYCODE.ESCAPE
         if @badgePresent()

      scope: @scopeInputEl.val()

      # Location badge
      _location: $.trim(@locationText.text())
    }

  bindEvents: ->
    @searchInput.on 'keyup', @onSearchInputKeyUp
    @searchInput.on 'click', @onSearchInputClick
    @searchInput.on 'focus', @onSearchInputFocus

    # Prevent multiple ajax calls
    return if @loadingSuggestions

    return if @badgePresent()

    @loadingSuggestions = true

    jqXHR = $.get(@autocompletePath, {
