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

Proposal: add commands.OnCommandData similar to menus.OnClickData #568

Open
jpc-ae opened this issue Mar 18, 2024 · 1 comment
Open

Proposal: add commands.OnCommandData similar to menus.OnClickData #568

jpc-ae opened this issue Mar 18, 2024 · 1 comment
Labels
follow-up: chrome Needs a response from a Chrome representative needs-triage: firefox Firefox needs to assess this issue for the first time supportive: safari Supportive from Safari

Comments

@jpc-ae
Copy link

jpc-ae commented Mar 18, 2024

A sticking point with adding shortcut keys at the moment is the lack of information provided to the extension when onCommand is called.

My use case involves storing selected text or inputting data into a field when the user requests it. In order to limit the permissions required, my app only requests the activeTab permission with <all_urls> specified under optional_host_permissions. When a user clicks an item in the contextmenu, my service worker is provided with an OnClickData object I can use to handle embedded frames by:

  1. Confirming the extension has required host permissions for the frameUrl and otherwise request it of the user
  2. Confirming the frameId required to inject the script

Without this information and no reliable way of getting a frameId from the parent page, extensions are required to:

  1. Have the webNavigation permission to determine what frames are on the page (since the frame src is not a reliable indicator of its current url)
  2. Potentially request more host permissions than necessary when a page has several frames embedded, just to spy out which one currently has focus

At least for my use case, commands including a data object similar to the one for menus would mean less need for additional permissions and workarounds, as well as less friction for users. I imagine there will be use cases for many of the other fields exposed in OnClickData as well.

@jpc-ae jpc-ae changed the title Proposal: add commands.onCommandData when a command is called similar to menus.onClickData Proposal: add commands.OnCommandData similar to menus.onClickData Mar 18, 2024
@jpc-ae jpc-ae changed the title Proposal: add commands.OnCommandData similar to menus.onClickData Proposal: add commands.OnCommandData similar to menus.OnClickData Mar 18, 2024
@xeenon xeenon added supportive: safari Supportive from Safari 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 and removed needs-triage labels Mar 28, 2024
@oliverdunk oliverdunk added follow-up: chrome Needs a response from a Chrome representative and removed needs-triage: chrome Chrome needs to assess this issue for the first time labels Apr 23, 2024
@oliverdunk
Copy link
Member

For Chrome, switching to our follow-up label as I need to get thoughts from the team on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
follow-up: chrome Needs a response from a Chrome representative 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

3 participants