diff --git a/modules/keyboard.js b/modules/keyboard.js index b2af5c0ab1..ef779a870d 100644 --- a/modules/keyboard.js +++ b/modules/keyboard.js @@ -34,8 +34,14 @@ class Keyboard extends Module { }); this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter); this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function() {}); - this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace); - this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^$/ }, handleDelete); + if (/Gecko/i.test(navigator.userAgent)) { + // Need to handle delete and backspace for Firefox in the general case #1171 + this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace); + this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete); + } else { + this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace); + this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete); + } this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange); this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange); if (/Trident/i.test(navigator.userAgent)) {