testing/web-platform/tests/html/semantics/popovers/popover-attribute-all-elements.html
author Serban Stanca <sstanca@mozilla.com>
Mon, 14 Jul 2025 00:37:50 +0300 (115 minutes ago)
changeset 796395 57c30f1adca5fb5ccd4a9a09192c41e207e28d88
parent 664651 374226933a94750dd53b358cdd1357e00f132237
permissions -rw-r--r--
Revert "Bug 1950748 part 3: Don't return a caret inside an editor when no editor is focused. r=morgan" as requested for causing accessibility crashes (bug 1977012). This reverts commit aaf970807d281c28c1e937491719d996cb11648a. This reverts commit f5f2e3cf4d34c2430372ba790d77620837d56b75. This reverts commit 5565c5899c32c0b0f5446561a21c5b6499fd44c6.
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" href="mailto:masonf@chromium.org">
<link rel=help href="https://open-ui.org/components/popover.research.explainer">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/popover-utils.js"></script>
<script src="../../resources/common.js"></script>

<body>
<script>
setup({ explicit_done: true });
window.onload = () => {
  // Loop through all HTML elements that render a box by default:
  let elementsThatDontRender = ['area', 'audio','base','br','datalist','dialog','embed','head','link','meta','noscript','optgroup','option','param','rp','script','slot','style','template','title','wbr'];
  const elements = HTML5_ELEMENTS.filter(el => !elementsThatDontRender.includes(el));
  elements.forEach(tag => {
    test((t) => {
      const element = document.createElement(tag);
      element.setAttribute('popover','auto');
      document.body.appendChild(element);
      t.add_cleanup(() => element.remove());
      assertIsFunctionalPopover(element, true);
    }, `A <${tag} popover> element should behave as a popover.`);
    test((t) => {
      const element = document.createElement(tag);
      document.body.appendChild(element);
      t.add_cleanup(() => element.remove());
      assertNotAPopover(element);
    }, `A <${tag}> element should *not* behave as a popover.`);
  });
  elementsThatDontRender.forEach(tag => {
    test((t) => {
      const element = document.createElement(tag);
      element.setAttribute('popover','auto');
      document.body.appendChild(element);
      t.add_cleanup(() => element.remove());
      assertIsFunctionalPopover(element, false);
    }, `A <${tag} popover> element should not be rendered.`);
  });
  done();
};
</script>