[PSA] Support for "tab" Context in chrome.contextMenus (M150)

10 views
Skip to first unread message

Miguel Ruiz

unread,
1:54 PM (1 hour ago) 1:54 PM
to chromium-...@chromium.org

[PSA] Support for "tab" Context in chrome.contextMenus (M150) tl;dr: Starting in Chrome 150, the chrome.contextMenus API now supports a new tab context menu. This allows extensions to seamlessly integrate custom actions directly into the native browser tab strip's right-click menu, eliminating the need for disjointed UI workarounds.

What's Changing?

This update addresses a long-standing ecosystem request (Issue 40246822) by adding a "tab" option to the existing ContextType enum.

Key Technical Details & API Behavior

  • API Update: The chrome.contextMenus API reference was updated to reflect the new "tab" context.

  • Event Payload: When a custom menu item is clicked from a tab's context menu, the chrome.contextMenus.onClicked listener fires asynchronously and receives:

  1. info (OnClickData): The pageUrl property is automatically populated with the URL of the tab where the right-click occurred (web_contents->GetLastCommittedURL()).

  2. tab (tabs.Tab): A standard tab object representing the right-clicked tab.

  • Multiple Tab Selection: If a user has multiple tabs selected (e.g., via Shift+Click), the tab argument in the event listener represents only the specific tab that was right-clicked to open the context menu. This is consistent with Firefox's existing implementation.

  • Favicon Attribution: Registered extension items will automatically feature the extension's icon/favicon next to their label in the native menu for clear user attribution.

Use

  • Test Your Extensions: We highly recommend testing your tab management or utility extensions in Chrome Canary (M150).

  • Adopt the New Context: You can begin registering your context menus with the "tab" context:

codeimg-facebook-shared-image.jpeg


  • Provide Feedback: We encourage you to try this out and report any issues, regressions, or general feedback on crbug.com


Timeline

  • Chrome 150 (Canary/Dev): Available now for testing.

  • Chrome 150 (Stable): Expected release in line with the Chrome M150 release cycle.

On behalf of the Chrome Extensions team, Miguel Ruiz

Google Logo
Miguel Ruiz
Software Engineer
Chrome Accessibility
migue...@gmail.com
Reply all
Reply to author
Forward
0 new messages