DeclarativeContent in Manifest V3 – how to disable action on non-matching pages?

82 views
Skip to first unread message

Enosh Joseph

unread,
Jan 21, 2026, 12:18:31 AMJan 21
to chromium-...@chromium.org, olive...@google.com
Hi,

I’m developing a Chrome extension using Manifest V3 and trying to achieve page-action–like behavior (enable the extension only on specific pages).

I’m using chrome.declarativeContent with PageStateMatcher and ShowAction() to enable the action on matching URLs (for example, Wikipedia article pages).

However, I noticed that:

  • chrome.declarativeContent.HideAction() does not exist in MV3

  • ShowAction() only enables the action, but there is no declarative way to disable or hide it on non-matching pages

  • Once the action is enabled (or pinned), it stays enabled on all pages

This leads to a few questions:
  • Is it expected behavior in MV3 that declarativeContent can only enable actions but not disable them?

I want to make sure I’m following the official and future-proof pattern.

image.png

image.png
here is my eventPage.js and manifest.json

Thanks in advance!

woxxom

unread,
Jan 21, 2026, 4:33:27 AMJan 21
to Chromium Extensions, Enosh Joseph, olive...@google.com
Looks like a bug in the API implementation or design. Judging by the example in the documentation, the idea was that you disable the action by default via chrome.action.disable() and then let chrome.declarativeContent enable it conditionally, but chrome.action.disable() doesn't work globally, it just applies to one tab, which makes the entire idea of chromeContent API useless as you would have to wake up the service worker wastefully for every navigation in every tab to disable the action button for this tab.

Personally I dislike this approach because disabling the action icon forces the normal click on the icon to show the right-click menu, which is confusing to the user and a more sensible UX would be to just disable the normal click altogether.

A practical workaround I would use is to explicitly change the icon on the matching pages as shown in https://stackoverflow.com/a/64475504 and then inside the popup script I'd check the tab's URL and if it's not matching I'd show some generic info and/or options in the popup.

Reply all
Reply to author
Forward
0 new messages