Open Bug 1418984 Opened 6 years ago Updated 1 year ago

Webextensions commands manifest key should allow locale/language specific keyboard shortcut suggestions in manifest.json

Categories

(WebExtensions :: General, enhancement, P5)

58 Branch
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: original.roju, Unassigned)

References

Details

(Whiteboard: [design-decision-approved])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20171112125346

Steps to reproduce:

In Firefox 58 (Developer Edition), attempts to set locale-specific keyboard shortcuts in manifest.json result in an error when trying to load the extension.

Steps to reproduce:
1. Create an extension with a working keyboard command and locales support
2. Attempt to localize the shortcut (see sample json keys below)
3. Load the addon in about:debugging


manifest.json:
  "commands": {
    "somecommand": {
      "suggested_key": {
        "default": "__MSG_keyboardShortcut__"
      },
      "description": "Change to the most recent tab on this window."
    }
  },
  …

_locales/en/messages.json:
  "keyboardShortcut": {
    "message": "Ctrl+Shift+1",
    "description": "Sets a locale-specific shortcut. See: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands#Shortcut_values"
  }
  …



Actual results:

1. The addon fails to load with the message "There was an error during installation: Extension is invalid"
2. The following errors are printed in the browser console:

Error: Extension is invalid
Stack trace:
loadManifestFromWebManifest@resource://gre/modules/addons/XPIInstall.jsm:333:11
  protocol.js:964

1511183928379	addons.webextension.<unknown>	ERROR	Loading extension 'null': Reading manifest: Error processing commands.most-recent-tab-command.suggested_key.default: Value "__MSG_extensionName__" must either: match the pattern /^\s*(Alt|Ctrl|Command|MacCtrl)\s*\+\s*(Shift\s*\+\s*)?([A-Z0-9]|Comma|Period|Home|End|PageUp|PageDown|Space|Insert|Delete|Up|Down|Left|Right)\s*$/, match the pattern /^\s*((Alt|Ctrl|Command|MacCtrl)\s*\+\s*)?(Shift\s*\+\s*)?(F[1-9]|F1[0-2])\s*$/, or match the pattern /^(MediaNextTrack|MediaPlayPause|MediaPrevTrack|MediaStop)$/



Expected results:

1. The extension loads successfully
2. The localized keyboard shortcut triggers the command in the addon
Severity: normal → enhancement
Priority: -- → P5
Whiteboard: [design-decision-needed]
Hi PaulV, this has been added to the agenda for the WebExtensions APIs triage meeting on December 5. Would you be able to join us? 

Here’s a quick overview of what to expect at the triage: 

* We normally spend 5 minutes per bug
* The more information in the bug, the better
* The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details

Relevant Links: 

* Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting
* Meeting agenda: https://docs.google.com/document/d/1MduEIKmXDdj3p94PJDrPPPYvbSfEdrrMF-UhMnHPqEQ/edit#heading=h.edrw957gm8hg
* Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
(In reply to Caitlin Neiman [:caitmuenster] from comment #1)
> Hi PaulV, this has been added to the agenda for the WebExtensions APIs
> triage meeting on December 5. Would you be able to join us? 

Hi, I don't think I can commit to making it to the meeting. I can add some information here though.

The reason I made this request was due to some feedback I got in a review on AMO https://addons.mozilla.org/en-US/firefox/addon/most-recent-tab/reviews/. The user noted that in their locale, the default shortcut I had picked, Ctrl-Shift-1, which works great on a US English keyboard, is not good on their locale's keyboard.

The smallest touch fix would be to allow locale specific default keyboard shortcuts, which is what I've requested in this bug.

There are some alternative solutions. 

Bug #1303384 would allow users to set their own shortcut. This is also a common request / review note I've been getting since porting to WebExtensions so I hope this happens either way.

Bug #1348589 would allow developers to set shortcuts programmatically (e.g.s through prompting the user on a custom options pane or by locale).

Cross-browser wise, it looks like Chrome does not allow localized default shortcuts in the manifest.

Hope this helps!
See Also: → 1421811
Whiteboard: [design-decision-needed] → [design-decision-approved]
Product: Toolkit → WebExtensions
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
Flags: needinfo?(gchino5150)
Flags: needinfo?(gchino5150)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.