Skip to content

Add action.restorePopup() #876

@carlosjeurissen

Description

@carlosjeurissen

background

Our 2025-09-25 meeting discussed some of the use-cases of runtime.getManifest().

One use case is restoring the action popup back to the manifest state. Some extensions temporarily want to disable the popup so they can listen for action.onClicked. To later restore the popup behaviour.

Firefox currently this by setting the popup to null. Since Safari 18, this also works in Safari.

browser.action.setPopup({
  popup: null
});

To deal with this in a generic way in Chrome, one would need to get the specified popup from the manifest with runtime.getManifest().

api design

A more semantic api would be action.restorePopup() which is also easy to feature detect and can potentially overrule the sidePanel behaviour.

interface Action {
  restorePopup(options?: { tabId?: number; windowId?: number }): Promise<void>;
}

If I am correct calling action.setPopup({popup: null}) in Safari would not throw in Safari below 18, which makes feature-detection tricky. Have not tested this. If it turns out Safari properly throws an error before Safari 18, we could potentially stick to setting popup: null as Chrome does throw currently when calling setPopup with null.

sidePanel behavior

Up for discussion is whether or not the restorePopup() should reset the openPanelOnActionClick sidePanel feature.

chrome.sidePanel.setPanelBehavior({
  openPanelOnActionClick: false
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    inconsistencyInconsistent behavior across browsersneeds-triage: firefoxFirefox needs to assess this issue for the first timeneeds-triage: safariSafari needs to assess this issue for the first timetopic: action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions