summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/accessibility/crashtests/aria-modal-aria-hidden.html
blob: 520710381c7573faf41982f39ea446ac9cb249b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- Test that aria-modal, aria-owns, aria-hidden, and aria-labelledby can work together without crashing.
     This test case is a minimized version of a crash that occurred from a chat app. -->
<!DOCTYPE html>
<html class="test-wait">
<div role="main" aria-owns="owned"></div>
<div id="owned">
  <span aria-hidden="true" id="hidden-label"></span>
</div>
<div role="dialog" aria-modal="true">
  <a aria-labelledby="hidden-label"></a>
</div>
<script>
let dialogNode = null;

document.addEventListener('DOMContentLoaded', () => {
  dialogNode = document.querySelector("[role=dialog]")
  dialogNode.remove();
  requestAnimationFrame(() => {
    requestAnimationFrame(() => {
      document.querySelector("[role=main]").setAttribute("aria-hidden", true);
      document.querySelector("body").appendChild(dialogNode);
      document.documentElement.className = '';
    });
  });
});

</script>
</html>