         @_searchFor e.currentTarget.value
       , false
 
-      @el.addEventListener 'keypress', (e) =>
+      @el.addEventListener 'keydown', (e) =>
         if @showingList
           @_handleKeypress e
 
-      # this needs to be fixed - doesn't pick up span click
       @el.parentNode.addEventListener 'click', (e) =>
-        if e.target.tagName == 'LI'
-          @el.value = e.target.textContent
-          @_removeResults()
+        if e.target.tagName == 'A'
+          if e.target.getAttribute('href') == '#'
+            e.preventDefault()
+            @el.value = e.target.textContent
+            @_removeResults()
 
     _handleKeypress: (e) ->
+      console.log e
       if e.keyCode == 40 # down arrow
         e.preventDefault()
         @_highlightDown()


    _createListItem: (item) ->
      listItem = document.createElement 'LI'
      listItem.className = 'autocomplete__result'

      if @responseMap.type
        listItem.classList.add 'autocomplete_result__type'
        listItem.classList.add "autocomplete__result__type--#{item[@responseMap.type]}"

      if @responseMap.uri
        listItem.appendChild @_createAnchor(item)
      else
        listItem.innerHTML = @_highlightText item[@responseMap.title], @searchTerm

      listItem

    _createAnchor: (item) ->
      anchor = document.createElement 'A'
      anchor.href = item[@responseMap.uri]

      if @searchTerm
        anchor.innerHTML = @_highlightText item[@responseMap.title], @searchTerm

    _searchFor: (searchTerm)  ->
      if searchTerm && searchTerm.length >= 3
        @searchTerm = searchTerm
        @_doRequest @searchTerm
      else if @showingList
        @_removeResults()

    _doRequest: ->
      if not @throttled
        myRequest = new XMLHttpRequest()
        myRequest.addEventListener 'readystatechange', =>
          if myRequest.readyState == 4
            if myRequest.status == 200
              @_updateUI JSON.parse myRequest.responseText

        myRequest.open 'get', @_generateURI(@args.uri, @args.scope)
        myRequest.setRequestHeader 'Accept', '*/*'
        myRequest.send()
        @throttled = true
        window.setTimeout =>
          @throttled = false
        , 200

    _generateURI: (searchURI, scope) ->
      uri = "#{searchURI}#{@searchTerm}"
