diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => '2fbe65a2', - 'core.pkg.js' => 'f2139810', + 'core.pkg.js' => '49f8bdc0', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '3e81ae60', 'differential.pkg.js' => '634399e9', @@ -463,7 +463,7 @@ 'rsrc/js/core/FileUpload.js' => '680ea2c8', 'rsrc/js/core/Hovercard.js' => '1bd28176', 'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2', - 'rsrc/js/core/KeyboardShortcutManager.js' => 'c1700f6f', + 'rsrc/js/core/KeyboardShortcutManager.js' => '4a021c10', 'rsrc/js/core/MultirowRowManager.js' => 'b5d57730', 'rsrc/js/core/Notification.js' => 'ccf1cbf8', 'rsrc/js/core/Prefab.js' => 'cfd23f37', @@ -780,7 +780,7 @@ 'phabricator-filetree-view-css' => 'fccf9f82', 'phabricator-flag-css' => '5337623f', 'phabricator-keyboard-shortcut' => '1ae869f2', - 'phabricator-keyboard-shortcut-manager' => 'c1700f6f', + 'phabricator-keyboard-shortcut-manager' => '4a021c10', 'phabricator-main-menu-view' => 'b623169f', 'phabricator-nav-view-css' => 'ac79a758', 'phabricator-notification' => 'ccf1cbf8', @@ -1222,6 +1222,13 @@ 'javelin-dom', 'javelin-stratcom', ), + '4a021c10' => array( + 'javelin-install', + 'javelin-util', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-vector', + ), '4b700e9e' => array( 'javelin-behavior', 'javelin-dom', @@ -1882,13 +1889,6 @@ 'javelin-install', 'javelin-dom', ), - 'c1700f6f' => array( - 'javelin-install', - 'javelin-util', - 'javelin-stratcom', - 'javelin-dom', - 'javelin-vector', - ), 'c587b80f' => array( 'javelin-install', ), diff --git a/webroot/rsrc/js/core/KeyboardShortcutManager.js b/webroot/rsrc/js/core/KeyboardShortcutManager.js --- a/webroot/rsrc/js/core/KeyboardShortcutManager.js +++ b/webroot/rsrc/js/core/KeyboardShortcutManager.js @@ -32,6 +32,18 @@ down: 1 }, + /** + * Some keys require Alt to be pressed in order to type them on certain + * keyboard layouts. + */ + _altkeys: { + // "Alt+L" on German layouts. + '@': 1, + + // "Alt+Shift+7" on German layouts. + '\\': 1 + }, + getInstance : function() { if (!JX.KeyboardShortcutManager._instance) { JX.KeyboardShortcutManager._instance = new JX.KeyboardShortcutManager(); @@ -119,14 +131,24 @@ } }, _onkeyhit : function(e) { + var self = JX.KeyboardShortcutManager; + var raw = e.getRawEvent(); - if (raw.altKey || raw.ctrlKey || raw.metaKey) { + if (raw.ctrlKey || raw.metaKey) { // Never activate keyboard shortcuts if modifier keys are also // depressed. return; } + // For most keystrokes, don't activate keyboard shortcuts if the Alt + // key is depressed. However, we continue if the character requires the + // use of Alt to type it on some keyboard layouts. + var key = this._getKey(e); + if (raw.altKey && !(key in self._altkeys)) { + return; + } + var target = e.getTarget(); var ignore = ['input', 'select', 'textarea', 'object', 'embed']; if (JX.DOM.isType(target, ignore)) {