summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-04-13 06:43:21 +0200
committerByron Jones <glob@mozilla.com>2015-04-13 06:43:21 +0200
commit1936c58bde79b61fbe6219df12f6a15decb95c59 (patch)
treeb84d5828a320b003cda5bbf5499d2d56670d3be4 /extensions/BugModal
parent497c70791868264ddb0499970ea0323988bdcdb0 (diff)
downloadbugzilla-1936c58bde79b61fbe6219df12f6a15decb95c59.tar.gz
bugzilla-1936c58bde79b61fbe6219df12f6a15decb95c59.tar.xz
Bug 1152118: Shortcut for editing gets triggered even when "ctrl" and "e" are not pressed at the same time
Diffstat (limited to 'extensions/BugModal')
-rw-r--r--extensions/BugModal/web/bug_modal.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index babbdbe14..bd529fab1 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -732,16 +732,17 @@ $(function() {
.change();
// hotkeys
- $('body').hotkey('ctrl+e', function() {
- if ($('#cancel-btn:visible').length == 0) {
- $('#mode-btn').click();
- }
- } );
- $('body').hotkey('escape', function() {
- if ($('#cancel-btn:visible').length != 0) {
- $('#cancel-btn').click();
- }
- } );
+ $(window)
+ .keydown(function(event) {
+ if (!(event.ctrlKey || event.metaKey))
+ return;
+ if (String.fromCharCode(event.which).toLowerCase() == 'e') {
+ if ($('#cancel-btn:visible').length == 0) {
+ event.preventDefault();
+ $('#mode-btn').click();
+ }
+ }
+ });
// add cc button
$('#add-cc-btn')