v132 · dom
Throw exception for popovers/dialogs in non-active documents
This is a corner case change that hopefully does not impact developers. Previously calling `showPopover()` or `showModal()` on a popover or dialog that resides within an inactive document would silently fail. I.e. no exception would be thrown, but since the document is inactive, no popover or dialog would be shown. As of the https://github.com/whatwg/html/pu
concepts
-
Inactive doc throw
showModal()/showPopover() on inactive documents throw InvalidStateError instead of silently no-oping. Surfaces bugs that previously slipped past.
-
error matrix
Run all seven ways a dialog/popover lands in an inactive document — iframe, parseFromString, adopt-then-detach — and confirm each throws.
-
Iframe Popover Test
Run each method — showPopover(), hidePopover(), togglePopover(), showModal(), close() — in both active and detached contexts. See exactly which throw
InvalidStateErrorin Chrome 132+. -
lifecycle traps
Five real-world lifecycle scenarios where this throws: unloading tab, bfcache, detached iframe, navigation race, document.open(). Plus the canonical safe-show wrapper.
-
Iframe Document Tester
Six test scenarios — active document, detached element, adopted element, dialog showModal, try/catch pattern, and active dialog — run live to confirm Chrome 132's
NotSupportedErroron inactive documents vs silent fail in older browsers.
why it shipped
This is a corner case change that hopefully does not impact developers. Previously calling `showPopover()` or `showModal()` on a popover or dialog that resides within an inactive document would silently fail. I.e. no exception would be thrown, but since the document is inactive, no popover or dialog would be shown. As of the https://github.com/whatwg/html/pu