Show approval in browser-action popup instead of a separate window
Some checks failed
check / check (push) Has been cancelled

Use action.openPopup() to show the approval in the toolbar popup,
which is anchored to the browser window and cannot trigger a macOS
Space switch. Falls back to a separate window if openPopup() is
unavailable. A port connection detects when the popup is dismissed
without a response, and the popup URL is reset to the main UI after
every approval resolution.
This commit is contained in:
2026-02-26 12:16:41 +07:00
parent dce3b4aa08
commit a590cfc3ad
2 changed files with 73 additions and 27 deletions

View File

@@ -8,6 +8,9 @@ let approvalId = null;
function show(id) {
approvalId = id;
// Connect a port so the background detects if the popup closes
// without an explicit response (e.g. user clicks away).
runtime.connect({ name: "approval:" + id });
runtime.sendMessage({ type: "AUTISTMASK_GET_APPROVAL", id }, (details) => {
if (!details) {
window.close();