Skip to content

Commit

Permalink
need to always handle backspace for firefox
Browse files Browse the repository at this point in the history
fixes slab#1171
  • Loading branch information
jhchen committed Dec 8, 2016
1 parent d2cffa6 commit 9415eeb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 9415eeb

Please sign in to comment.