Skip to content

Commit f7ecd0b

Browse files
committed
Drop the guard against unreadable key events
The try/catch probe dates to 2016, when Firefox threw on reading an event's properties across origins; that bug is long fixed, and the guard covered only three of the properties the handlers go on to read.
1 parent 1c85594 commit f7ecd0b

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

‎assets/javascripts/app/shortcuts.js‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ export class Shortcuts extends Events {
7070

7171
/** @param {ShortcutEvent} event */
7272
onKeydown(event) {
73-
if (this.buggyEvent(event)) {
74-
return;
75-
}
7673
const result = (() => {
7774
if (event.ctrlKey || event.metaKey) {
7875
if (!event.altKey) {
@@ -100,10 +97,7 @@ export class Shortcuts extends Events {
10097

10198
/** @param {ShortcutEvent} event */
10299
onKeypress(event) {
103-
if (
104-
this.buggyEvent(event) ||
105-
(event.key === "?" && document.activeElement.tagName === "INPUT")
106-
) {
100+
if (event.key === "?" && document.activeElement.tagName === "INPUT") {
107101
return;
108102
}
109103
if (!event.ctrlKey && !event.metaKey) {
@@ -364,19 +358,4 @@ export class Shortcuts extends Events {
364358
return (this.lastKeypress = Date.now());
365359
}
366360
}
367-
368-
/**
369-
* @param {ShortcutEvent} event
370-
* @returns {boolean} Whether the event is one the browser reports incorrectly.
371-
*/
372-
buggyEvent(event) {
373-
try {
374-
event.target;
375-
event.ctrlKey;
376-
event.key;
377-
return false;
378-
} catch (error) {
379-
return true;
380-
}
381-
}
382361
}

0 commit comments

Comments
 (0)