   # highest priority.
   keypress: suppressEvent
   keyup:    suppressEvent
-
-  popupshown:  checkPassthrough
-  popuphidden: checkPassthrough
 
   # When the top level window closes we should release all Vims that were
   # associated with tabs in this window

    return keyStr

  return null

# Passthrough mode is activated when VimFx should temporarily stop processing keyboard input, for
# example when a menu is shown.
popupPassthrough = false
checkPassthrough = (event) ->
  if event.target.nodeName in ['menupopup', 'panel']
    popupPassthrough = switch event.type
      when 'popupshown'  then true
      when 'popuphidden' then false

suppress = false
suppressEvent = (event) ->

      # No matter what, always reset the `suppress` flag, so we don't suppress more than intended.
      suppress = false

      return if getPref('disabled')

      return unless rootWindow = utils.getEventRootWindow(event)
      popups = rootWindow.document.querySelectorAll('menupopup, panel')
      for popup in popups
        return if popup.state == 'open'

      return unless window = utils.getEventCurrentTabWindow(event)
      return unless vim = vimBucket.get(window)
