From e74f7bde22c469ca90316f7bd69a0ba5233f8bff Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Mon, 11 Mar 2019 11:29:10 +0100 Subject: Refactor hotkeys to use keypress instead of keydown keydown returns the "raw" key in event.which. Depending on the keyboard layout, this may not be what is wanted. For example, on a German keyboard, Shift+7 has to be pressed to get a slash. However, event.which will be 55, which corresponds to "7". In the keypress event, however, event.which will be 47, which corresponds to "/". Sadly, several important keys (such as escape and the arrow keys) do not trigger a keypress event. Therefore, they have to be handled using a keydown event. This change refactors the hotkey support to make use of keypress events whenever possible. This will make hotkeys work regardless of the user's keyboard layout. Escape and arrow keys are still handled via keydown events. There should be only one change in behavior: I could not make Ctrl+/ work and therefore rebound the help dialog to "?". --- js/prefs.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/prefs.js') diff --git a/js/prefs.js b/js/prefs.js index b4ac9976e..ae6286330 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -78,6 +78,7 @@ require(["dojo/_base/kernel", this.enableCsrfSupport(); document.onkeydown = (event) => { return App.hotkeyHandler(event) }; + document.onkeypress = (event) => { return App.hotkeyHandler(event) }; App.setLoadingProgress(50); Notify.close(); -- cgit v1.2.3