dialog-inert.html (1062B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="author" title="Mozilla" href="https://mozilla.org"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 body { margin: 0 } 9 dialog { 10 width: 100%; 11 height: 100%; 12 max-width: 100%; 13 max-height: 100%; 14 box-sizing: border-box; 15 padding: 0; 16 } 17 dialog::backdrop { 18 display: none; 19 } 20 </style> 21 <dialog id=dialog>Something</dialog> 22 <script> 23 test(function() { 24 let dialog = document.getElementById("dialog"); 25 dialog.showModal(); 26 assert_equals( 27 document.elementFromPoint(10, 10), 28 dialog, 29 "Dialog is hittable by default", 30 ); 31 dialog.inert = true; 32 assert_not_equals( 33 document.elementFromPoint(10, 10), 34 dialog, 35 "Dialog becomes inert dynamically", 36 ); 37 dialog.close(); 38 dialog.showModal(); 39 assert_not_equals( 40 document.elementFromPoint(10, 10), 41 dialog, 42 "Dialog remains inert after open", 43 ); 44 }); 45 </script>