The .pete-reader-typemenu class sets display:flex, which outranks the UA [hidden]{display:none} rule, so toggling typeMenu.hidden never hid the popover. Add an explicit [hidden] guard.