title: Cannot close <dialog> element with display set to grid
body: <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/close" rel="nofollow noreferrer">HtmlDialogElement.close()</a> function seems to have no effect on a <code>&lt;dialog&gt;</code> element when that dialog has its <code>display</code> style set to <code>grid</code>.</p>
  <p>Does anyone happen to know why? Note that removing the <code>display: grid</code> allow the dialog to function correctly. I have seen this behavior on the latest versions of both Chrome and Firefox.</p>
  <p>See minimum reproduction below. If you prefer, here's a Codepen: <a href="https://codepen.io/ChristianMay/pen/MWrmdzJ" rel="nofollow noreferrer">https://codepen.io/ChristianMay/pen/MWrmdzJ</a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let dialog = document.querySelector('dialog')
  let closeButton = document.querySelector("#dialog-close");
  closeButton.addEventListener('click', () =&gt; {
    dialog.close();
  })</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>dialog {
    display: grid;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;dialog class="dialog" open=""&gt;
    Test
  &lt;/dialog&gt;
  
  &lt;button id="dialog-close"&gt;Close dialog&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>