title: dispatchEvent causes page reload
body: <p>I have been working with some modal code demonstrated at <a href="http://codepen.io/ettrics/pen/Jdjdzp/" rel="nofollow">CodePen</a>. Nice Material design style modals but as demonstrated, to activate, they essentially require a click on an <code>&lt;a&gt;</code> tag which has a class of <code>modal__trigger</code>. In the demo page, they are restyled as buttons.</p>
  
  <p>I want to programmatically trigger a modal and so I have created the following code. The first line is the trigger. The remainder is the modal.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="" id="coordmodal-trigger"  data-modal="#coord-modal" class="modal__trigger"&gt;&lt;/a&gt;
  &lt;div id="coord-modal" class="modal modal__bg" role="dialog" aria-hidden="true"&gt;
    &lt;div class="modal__dialog"&gt;
      &lt;div class="modal__content"&gt;
        &lt;h4&gt;Location&lt;/h4&gt;
        &lt;p id="coordinates"&gt;-28.8050, 149.9483&lt;/p&gt;
        &lt;!-- modal close button --&gt;
        &lt;a id="coordmodal-close" href="" class="modal__close"&gt;
          &lt;svg class="" viewBox="0 0 24 24"&gt;&lt;path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z"/&gt;&lt;path d="M0 0h24v24h-24z" fill="none"/&gt;&lt;/svg&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Loading this in a page, I can see the trigger <code>&lt;a&gt;</code>. When I click on it, the modal appears with it's content - all good.</p>
  
  <p>However, from the console, simulating a click, when I type the following:</p>
  
  <p><code>var foo = document.getElementById('coordmodal-trigger');
  foo.dispatchEvent(new Event('click'));</code></p>
  
  <p>the modal appears without content and then the page reloads. I'm puzzled as to why this is occurring given that I am simply programatically producing a click event. Which should be the same as clicking on the link, should it not?</p>