Skip to content

Commit

Permalink
Avoid browser back when holding down backspace key
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-g committed Feb 26, 2013
1 parent 4550d61 commit 772b5fa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/js/views/search_facet.js
Expand Up @@ -401,6 +401,16 @@ VS.ui.SearchFacet = Backbone.View.extend({
this.options.app.searchBox.focusNextFacet(this, -1, {startAtEnd: -1});
this.remove(e);
} else if (key == 'backspace') {
$(document).on('keydown.backspace', function(e) {
if (VS.app.hotkeys.key(e) === 'backspace') {
e.preventDefault();
}
});

$(document).on('keyup.backspace', function(e) {
$(document).off('.backspace');
});

if (this.modes.selected == 'is') {
e.preventDefault();
this.remove(e);
Expand All @@ -409,6 +419,7 @@ VS.ui.SearchFacet = Backbone.View.extend({
e.preventDefault();
this.selectFacet();
}
e.stopPropagation();
}

// Handle paste events
Expand Down

0 comments on commit 772b5fa

Please sign in to comment.