inert-form-control.html (1150B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://html.spec.whatwg.org/#inert-subtrees"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1926304"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <title>Inert doesn't prevent initiated click from changing form control</title> 10 <style> 11 label { 12 display: block 13 } 14 </style> 15 <div id="ancestor"> 16 <label> 17 <input type=radio name=foo value=1 checked> Something 18 </label> 19 <label id="target"> 20 <input type=radio name=foo value=2> Something else 21 </label> 22 </div> 23 <script> 24 let targetInput = target.querySelector("input"); 25 ancestor.addEventListener("click", () => { 26 ancestor.inert = true; 27 }); 28 promise_test(async function () { 29 assert_false(targetInput.checked, "input shouldn't be checked"); 30 await test_driver.click(target); 31 assert_true(ancestor.inert, "click handler should've ran"); 32 assert_true(targetInput.checked, "input should become checked"); 33 }); 34 </script>