popovertarget-disabled-fieldset.html (1192B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://github.com/whatwg/html/pull/8221#discussion_r987582567"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <div id=popover popover=auto>popover</div> 8 9 <fieldset> 10 <button id=popoverbutton popovertarget=popover>open popover with popovertarget</button> 11 <button id=commandbutton commandfor=popover command=show-popover>open popover with command</button> 12 </fieldset> 13 14 <script> 15 test(() => { 16 const popover = document.getElementById('popover'); 17 const fieldset = document.querySelector('fieldset'); 18 ['popoverbutton', 'commandbutton'].forEach(id => { 19 const button = document.getElementById(id); 20 button.click(); 21 assert_true(popover.matches(':popover-open'), 22 `${id}: popover should open when not disabled.`); 23 popover.hidePopover(); 24 25 fieldset.disabled = true; 26 button.click(); 27 assert_false(popover.matches(':popover-open'), 28 `${id}: popover should not open when disabled.`); 29 fieldset.disabled = false; 30 }); 31 }, 'Disabled fieldset ancestor should prevent popovertarget/command behavior.'); 32 </script>