Skip to content

Commit 9992148

Browse files
committed
fix shortcuts that only contain a modifier
#631 part 3
1 parent f1f8cc7 commit 9992148

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

js/keybindings.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,17 @@ document.body.addEventListener('keydown', function (e) {
443443

444444
webviews.bindEvent('before-input-event', function (e, input) {
445445
var expectedKeys = 1
446-
if (input.alt) {
446+
//account for additional keys that aren't in the input.key property
447+
if (input.alt && input.key !== "Alt") {
447448
expectedKeys++
448449
}
449-
if (input.shift) {
450+
if (input.shift && input.key !== "Shift") {
450451
expectedKeys++
451452
}
452-
if (input.control) {
453+
if (input.control && input.key !== "Control") {
453454
expectedKeys++
454455
}
455-
if (input.meta) {
456+
if (input.meta && input.key !== "Meta") {
456457
expectedKeys++
457458
}
458459

@@ -468,11 +469,11 @@ webviews.bindEvent('before-input-event', function (e, input) {
468469
(key === 'right' && input.key === 'ArrowRight') ||
469470
(key === 'up' && input.key === 'ArrowUp') ||
470471
(key === 'down' && input.key === 'ArrowDown') ||
471-
(key === 'alt' && input.alt) ||
472-
(key === 'shift' && input.shift) ||
473-
(key === 'ctrl' && input.control) ||
474-
(key === 'mod' && window.platformType === 'mac' && input.meta) ||
475-
(key === 'mod' && window.platformType !== 'mac' && input.control)
472+
(key === 'alt' && (input.alt || input.key === "Alt")) ||
473+
(key === 'shift' && (input.shift || input.key === "Shift")) ||
474+
(key === 'ctrl' && (input.control || input.key === "Control")) ||
475+
(key === 'mod' && window.platformType === 'mac' && (input.meta || input.key === "Meta")) ||
476+
(key === 'mod' && window.platformType !== 'mac' && (input.control || input.key === "Control"))
476477
)
477478
) {
478479
matches = false

0 commit comments

Comments
 (0)