Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding keyboard shortcut to context menu for Google Chrome extensions?

I'm trying to make an extension and which uses chrome.contextMenu. I create a contextMenu element and it works fine, but now I'm wondering if it is possible to add a keyboard shortcut to my element? I've looked through the documentation but could not find anything. Thanks!

like image 290
gimmian Avatar asked Jun 22 '15 21:06

gimmian


1 Answers

Sadly, no. There is an open feature request for it from 2012.

Issue 142840 in chromium: Add "shortcut" property to chrome.contextMenus API

Reported by [email protected], Aug 15, 2012

For native-like experience it should be possible to specify shortcut text for each menu item. E.g. if you create "Copy" menu item then there should be also "Ctrl+C" shortcut text shown next to it.

Proposed API:

   chrome.contextMenus.create({
      title: 'Copy',
      shortcut: 'Ctrl+C',
      id: 'copy',
      contexts: ['all']
 });

also see How can I display keyboard shortcuts to the context menu options created by my chrome extension?

I would also love to see a way to underline one of the letters in a custom context menu listing for ALT access but that appears to also be unsupported.

like image 185
stuart Avatar answered Sep 20 '22 11:09

stuart