Bug 128011 - Web Inspector: Layers and Node side panels shortcuts are not triggered when using Spanish keyboard layout
Summary: Web Inspector: Layers and Node side panels shortcuts are not triggered when u...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Minor
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-01-31 12:47 PST by Diego Pino
Modified: 2016-12-13 15:32 PST (History)
2 users (show)

See Also:


Attachments
Patch (1.97 KB, patch)
2014-01-31 12:54 PST, Diego Pino
timothy: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2014-01-31 12:47:46 PST
Shortcuts 'CmdOrCtrl+Shift+2' (open Node side panel) and 'CmdOrCtrl+Shift+3' (open Layers side panel) don't work when using Spanish keyboard layout. It works fine if I use US keyboard layout (Environment: WebKitGTK/Minibrowser; Ubuntu 13.04).

I debugged the issue and it seems that KeyboardShortcut.matchesEvent (KeyboardShortcut:74) returns false for these two shortcuts. What it happens is that an unexpected event.keyCode is sent:

  * 'Ctrl+Shift+2' sends event.keyCode = 222 (when it should be 50).
  * 'Ctrl+Shift+3' sends event.keyCode = 0 (when it should be 51).

This page is useful for testing purporses: http://www.asquare.net/javascript/tests/KeyCode.html. 

I researched a bit on the internet and I saw that this is a problem related to Javascript Key Events. In this page (http://news.qooxdoo.org/key-event-nightmare-resolved) it reads:

"The key code of keys that require the shift key on some keyboard layouts are not reliable. The key code which is generated depends on the current language-specific keyboard layout of the user."

So, I grepped shortcuts involving the Shift key and tested whether they work or not. Here is the result:

| *File* | *Shortcut* | *Action* | *Works* |
| ContentBrowser.js:46 | CmdOrCtrl + Shift + 'S' | _saveAs | Yes |
| DebuggerSidebarPanel.js:50 | CmdOrCtrl + Shift + ';' | _debuggerStepOutButtonClicked | Yes |
| FindBanner.js:84 | CmdOrCtrl + Shift + 'G' | _previousResultButtonClicked | Yes |
| JavaScriptLogViewController.js:55 | CmdOrCtrl + Shift + 'G' | _handleFindPreviousShortcut | Yes |
| JavaScriptLogViewController.js:60 | CmdOrCtrl + Shift + 'G' | _handleFindPreviousShortcut | Yes |
| Main.js:219 | CmdOrCtrl + Shift + 'R' | _reloadPageIgnoringCache | Yes |
| Main.js:221 | CmdOrCtrl + Shift + 'C' | _toggleInspectMode | Yes |
| Main.js:224 | CmdOrCtrl + Shift + 'Z' | _redoKeyboardShortcut | Yes |
| ResourceSidebarPanel.js:51 | CmdOrCtrl + Shift + 'F' | _focusSearchField | Yes |

Conclusion, all the other shortcuts (involving the Shift key) work and the only ones that fail are 'CmdOrCtrl+Shift+2' and 'CmdOrCtrl+Shift+3'.
Comment 1 Radar WebKit Bug Importer 2014-01-31 12:48:00 PST
<rdar://problem/15959734>
Comment 2 Diego Pino 2014-01-31 12:54:00 PST
Created attachment 222839 [details]
Patch
Comment 3 Diego Pino 2014-01-31 13:05:07 PST
The solution proposed in the patch is to use 'Option' instead of 'Shift' for the DetailsSidebarPanel.js buttons. 

I preferred not to change the other shortcuts as they are working. I'm aware this solution may solve only the issue for Spanish keyboard layout, but it might persist in other keyboard layouts.

My gut feeling is that 'Shift' is problematic in combination with number keys, but works fine with alphabetic characters (or punctuaction symbols like ';'). But this is just a wild guess, I have nothing to back up this statement :(
Comment 4 Timothy Hatcher 2014-02-05 11:16:03 PST
What platform were you using? I am wondering if Mac can stay as Option, since we match Xcode there.
Comment 5 Diego Pino 2014-02-05 17:09:44 PST
My environment is: 

   * OS: Ubuntu 13.04.
   * WebKit: WebKitGTK+/Minibrowser. I'm using WebKit2.

Maybe another possibility is to remap the shortcut as Ctrl + Number. That's the shortcut for the Menu buttons on the left side and it's working. But doing that means that the shorcut for the Menu buttons on the right side should start at 4. If I'm not wrong, up to 5 different sidepanels can be shown on the right side.
Comment 6 Timothy Hatcher 2014-02-11 16:38:19 PST
(In reply to comment #5)
> My environment is: 
> 
>    * OS: Ubuntu 13.04.
>    * WebKit: WebKitGTK+/Minibrowser. I'm using WebKit2.
> 
> Maybe another possibility is to remap the shortcut as Ctrl + Number. That's the shortcut for the Menu buttons on the left side and it's working. But doing that means that the shorcut for the Menu buttons on the right side should start at 4. If I'm not wrong, up to 5 different sidepanels can be shown on the right side.

That wouldn't be ideal. The idea of using a modifier and starting with 1 was to have left and right sidebars use the same modifiers and start with 1 — matching Xcode.
Comment 7 Timothy Hatcher 2015-04-25 18:37:17 PDT
Comment on attachment 222839 [details]
Patch

We don't have the shortcuts as of r183342.