     renderChat()
   $chat_name_input.on 'keydown', (event) ->
     event.stopPropagation()
-    if event.keyCode is 27
+    if event.which is 27
       # cancel
       done = true
-    else if event.keyCode is 13
+    else if event.which is 13
       # accept
       done = true
       setUserName $(event.target).val()

            # we didn't end up dragging, select the item
            selection.selectOnly 'playlist', track_id
            refreshSelection()
    else if event.button is 2
      return if event.altKey
      event.preventDefault()


  libraryMouseDown = (event, sel_name, key) ->
    # if any text box has focus, unfocus it
    $(document.activeElement).blur()
    if event.which is 1
      event.preventDefault()
      removeContextMenu()
      skip_drag = false
