summaryrefslogtreecommitdiffstats
path: root/browser/components
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-23 11:45:34 +0200
committerGitHub <noreply@github.com>2018-04-23 11:45:34 +0200
commit8ffac11aa6eb32be75ff049787191e12476586d3 (patch)
tree4a828895beb073d3d4a3791785bc6dcec1e3252c /browser/components
parentf5618cd8e900f37588a095381a8f2096d2038b5f (diff)
parente2649bc086f764859c94592b28237dab7d557493 (diff)
downloadUXP-8ffac11aa6eb32be75ff049787191e12476586d3.tar
UXP-8ffac11aa6eb32be75ff049787191e12476586d3.tar.gz
UXP-8ffac11aa6eb32be75ff049787191e12476586d3.tar.lz
UXP-8ffac11aa6eb32be75ff049787191e12476586d3.tar.xz
UXP-8ffac11aa6eb32be75ff049787191e12476586d3.zip
Merge pull request #232 from janekptacijarabaci/webextensions_shortcut_space_1
moebius#221: WebExtensions - commands API does not support shortcuts with space or numbers
Diffstat (limited to 'browser/components')
-rw-r--r--browser/components/webextensions/ext-commands.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/browser/components/webextensions/ext-commands.js b/browser/components/webextensions/ext-commands.js
index 3f0bf8d1a..b6e7ab3d1 100644
--- a/browser/components/webextensions/ext-commands.js
+++ b/browser/components/webextensions/ext-commands.js
@@ -163,11 +163,12 @@ CommandList.prototype = {
// The modifiers are the remaining elements.
keyElement.setAttribute("modifiers", this.getModifiersAttribute(parts));
- if (/^[A-Z0-9]$/.test(chromeKey)) {
+ if (/^[A-Z]$/.test(chromeKey)) {
// We use the key attribute for all single digits and characters.
keyElement.setAttribute("key", chromeKey);
} else {
keyElement.setAttribute("keycode", this.getKeycodeAttribute(chromeKey));
+ keyElement.setAttribute("event", "keydown");
}
return keyElement;
@@ -187,6 +188,9 @@ CommandList.prototype = {
* @returns {string} The constructed value for the Key's 'keycode' attribute.
*/
getKeycodeAttribute(chromeKey) {
+ if (/[0-9]/.test(chromeKey)) {
+ return `VK_${chromeKey}`;
+ }
return `VK${chromeKey.replace(/([A-Z])/g, "_$&").toUpperCase()}`;
},