      document.querySelector('dialog').addEventListener('click', (e) => {
        if (e.target === e.currentTarget) {
          e.currentTarget.close();
        }
      });
    </script>
  </body>
</html>
