Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/popovers/popovertarget-disabled-fieldset.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=popover popover=auto>popover</div>
<fieldset>
<button id=popoverbutton popovertarget=popover>open popover with popovertarget</button>
<button id=commandbutton commandfor=popover command=show-popover>open popover with command</button>
</fieldset>
<script>
test(() => {
const popover = document.getElementById('popover');
const fieldset = document.querySelector('fieldset');
['popoverbutton', 'commandbutton'].forEach(id => {
const button = document.getElementById(id);
button.click();
assert_true(popover.matches(':popover-open'),
`${id}: popover should open when not disabled.`);
popover.hidePopover();
fieldset.disabled = true;
button.click();
assert_false(popover.matches(':popover-open'),
`${id}: popover should not open when disabled.`);
fieldset.disabled = false;
});
}, 'Disabled fieldset ancestor should prevent popovertarget/command behavior.');
</script>