 # element of all and not directly on child elements. For example, when input is
 # disabled, its click handler is not called, but newsletter-dialog handler is.
   'click .newsletter-dialog, focus .newsletter-dialog, keypress .newsletter-dialog': (e, template) ->
-    e.newsletterDialogBoxEvent = true
+    e.dialogBoxEvent = true
     return # Make sure CoffeeScript does not return anything
 
   'submit .newsletter-subscribe': (e, template) ->

# element of all and not directly on child elements. For example, when input is
# disabled, its click handler is not called, but invite-dialog handler is.
  'click .invite-dialog, focus .invite-dialog, keypress .invite-dialog': (e, template) ->
    e.inviteDialogBoxEvent = true
    return # Make sure CoffeeScript does not return anything

  'submit .invite-send': (e, template) ->

$(document).on 'click focus keypress', (e) ->
  # originalEvent is defined only for native events, but we are triggering
  # click manually as well, so originalEvent is not always defined
  (Session.set variable, false for variable in ['newsletterActive', 'inviteDialogActive']) unless e.originalEvent?.dialogBoxEvent

  return # Make sure CoffeeScript does not return anything

