Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidePanel API: site-specific panels #618

Open
tophf opened this issue May 22, 2024 · 0 comments
Open

sidePanel API: site-specific panels #618

tophf opened this issue May 22, 2024 · 0 comments
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time supportive: safari Supportive from Safari

Comments

@tophf
Copy link

tophf commented May 22, 2024

Currently, if we want to toggle side panel's availability for a given tab id depending on its URL, we have to observe navigation in all tabs all the time, which frequently wakes up the background script, because we can't use url-filtering in webNavigation.onCommitted (or a filtered tabs.onUpdated in Firefox): it won't be triggered in the tab that previously contained our supported site example.com, but then was navigated to unsupported.com. We also can't register a listener for this tab id dynamically because such listeners won't wake up the background script.

Add URL patterns to chrome.sidePanel.setOptions()

It would be fully declarative, no need to observe navigation, here's some naming ideas:

  • urls and excludedUrls
  • matches and excludeMatches
  • documentUrlPatterns similarly to chrome.contextMenus.create and excludedDocumentUrlPatterns

Add documentId to chrome.sidePanel.setOptions()

Specifying documentId will automatically discard the specific options object when the page is destroyed on navigation or when the tab is closed, which will restore the global mode that we set in chrome.sidePanel.setOptions({enabled: false}). This solution can be used on top of the other solutions.

chrome.runtime.onInstalled.addListener(() => {
  chrome.sidePanel.setOptions({enabled: false});
});
chrome.webNavigation.onCommitted.addListener(e => {
  if (e.frameId) return;
  chrome.sidePanel.setOptions({
    enabled: true,
    tabId: e.tabId,
    documentId: e.documentId,
  });
}, {url: [{hostEquals: 'example.com'}]});

Add SetSidePanel action with parameters to declarativeContent API

A fully declarative method similar to SetIcon action.
The declarativeContent API already supports advanced URL filtering.

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels May 22, 2024
@xeenon xeenon added supportive: safari Supportive from Safari and removed needs-triage: safari Safari needs to assess this issue for the first time labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time supportive: safari Supportive from Safari
Projects
None yet
Development

No branches or pull requests

2 participants