code: function handleMousedown(event) {
  
    // get currently open dialogue
    var dialogue = getDialogueCurrent();
  
    if (dialogue.options.hardClose) {
      return;
    }
  
    var result = helper.isInside(event.target, dialogue.dialogue);
    if (!result) {
      closeInstance(dialogue);
    }
  }
docs: clicking anything not inside the most current dialogue