chromium/third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-dialog-element/dialog-cancel-with-select.html

<!DOCTYPE html>
<html>
<head>
  <title>Test dialog modal is closed by escape key with select focused</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resources/testdriver.js"></script>
  <script src="/resources/testdriver-vendor.js"></script>
  <link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=227534">
  <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1322947">
</head>
<body>
<p>Test dialog modal is closed by escape key with select focused</p>
<dialog id="dialog">
  <select>
    <option value="one">one</option>
    <option value="two">two</option>
  </select>
</dialog>

<script>
  setup({ single_test: true });

  const dialog = document.getElementById("dialog");
  const select = document.querySelector("select");

  dialog.addEventListener("close", function() {
    assert_false(dialog.open, "dialog with select is closed");
    done();
  });
  dialog.showModal();
  assert_true(select == document.activeElement, "select element should be focused");

  test_driver.send_keys(document.documentElement, "\uE00C"); // ESC key
</script>
</body>
</html>