I'm trying to find a way to detect when the user closes or dismisses the pop-up in an iOS Safari web extension.
I've tried listening for onblur, pagehide, and visibilitychange events but they are not fired when the popup is closed. All of these events do fire on macOS Safari 16, though.
Opening up a port by running browser.runtime.connect() in the popup and listening for onConnect/onDisconnect events in the background script only causes the onConnect event to fire when the popup is opened.