       name: "hint/#{mode.name}"
       indicator: false
       passInitialKeyupEvents: true
-      keydown: @onKeyDownInMode.bind this, hintMarkers
-      # Trap all other key events.
-      keypress: -> false
-      keyup: -> false
+      suppressAllKeyboardEvents: true
+      exitOnEscape: true
+      keypress: @onKeyDownInMode.bind this, hintMarkers
+
+    @hintMode.onExit =>
+      @deactivateMode() if @isActive
 
     @setOpenLinkMode mode
 

    hintMarkers

  matchHintsByKey: (hintMarkers, event) ->
    keyChar = KeyboardUtils.getKeyChar(event)
    delay = 0
    userIsTypingLinkText = false


            @setOpenLinkMode previousMode if @isActive
          true

    if (event.keyCode != keyCodes.shiftKey and event.keyCode != keyCodes.ctrlKey)
      keyResult = @getMarkerMatcher().matchHintsByKey(hintMarkers, event)
      linksMatched = keyResult.linksMatched
      delay = keyResult.delay ? 0
