Bug 85312 - Web Inspector: cmd-[ shortcut navigates page and is fr-keyboard incompatible
Summary: Web Inspector: cmd-[ shortcut navigates page and is fr-keyboard incompatible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
: 84092 86955 (view as bug list)
Depends on: 86955
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-01 14:34 PDT by Paul Irish
Modified: 2012-08-02 08:11 PDT (History)
12 users (show)

See Also:


Attachments
Patch (5.09 KB, patch)
2012-05-25 04:09 PDT, Alexander Pavlov (apavlov)
vsevik: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Irish 2012-05-01 14:34:42 PDT
Two independent, but related, issues:

1) cmd-[ on mac will navigate the parent page in addition to changing the inspector panel. All page state is lost as the page is navigated.

2) On a french keyboard, to type a ], you use `alt+gr + )`. Typed in the console, this trigger the inspector to go to the Elements panel. Interestingly [ causes no problems. This makes it impossible to type an array literal in the console.
Comment 1 Alexander Pavlov (apavlov) 2012-05-21 08:40:14 PDT
*** Bug 86955 has been marked as a duplicate of this bug. ***
Comment 2 Alexander Pavlov (apavlov) 2012-05-21 09:10:43 PDT
(In reply to comment #0)
> Two independent, but related, issues:
> 
> 1) cmd-[ on mac will navigate the parent page in addition to changing the inspector panel. All page state is lost as the page is navigated.

I'm unable to reproduce this one on a recent build (May 11).

> 2) On a french keyboard, to type a ], you use `alt+gr + )`. Typed in the console, this trigger the inspector to go to the Elements panel. Interestingly [ causes no problems. This makes it impossible to type an array literal in the console.

Assuming this one conveys the contents of bug 86955, will submit a patch for this one shortly.
Comment 3 Alexander Pavlov (apavlov) 2012-05-21 10:06:45 PDT
Darin, I vaguely remember you hack on the keyboard event handling in Chromium. Do you have a clue if the following behavior is correct or not?

Chromium produces exactly the same Event data for "Ctrl"+"Alt"+"[" on the English QUERTY keyboard and for "AltGr"+")" (to enter the "]" character) on the French AZERTY keyboard (yes, in the latter case the event flags are:

altGraphKey: false
altKey: true
ctrlKey: true
keyCode: 219
keyIdentifier: "U+00DB"
metaKey: false
shiftKey: false
).

Or should we monitor the modifier key states manually...
Comment 4 Paul Irish 2012-05-21 21:34:32 PDT
(In reply to comment #2)
> > 1) cmd-[ on mac will navigate the parent page in addition to changing the inspector panel. All page state is lost as the page is navigated.
> 
> I'm unable to reproduce this one on a recent build (May 11).


I can repro in Canary and a recent WebKit nightly.

Steps:

1) on this page, click to bug 86955
2) cmd-opt-i to open inspector (mine currently opens to Scripts)
3) cmd-[

Results: 

Inspector moves to Network while parent page navigates back to this ticket
Comment 5 Alexander Pavlov (apavlov) 2012-05-24 08:08:32 PDT
(In reply to comment #4)
> (In reply to comment #2)
> > > 1) cmd-[ on mac will navigate the parent page in addition to changing the inspector panel. All page state is lost as the page is navigated.
> > 
> > I'm unable to reproduce this one on a recent build (May 11).
> 
> 
> I can repro in Canary and a recent WebKit nightly.
> 
> Steps:
> 
> 1) on this page, click to bug 86955
> 2) cmd-opt-i to open inspector (mine currently opens to Scripts)
> 3) cmd-[
> 
> Results: 
> 
> Inspector moves to Network while parent page navigates back to this ticket

OK, I get the point. This works as intended, since on Mac, Cmd-[ is a standard Chrome shortcut to navigate back to the previous page (and Cmd-] navigates forward in the history). This works the same way as Alt-Left/Right on Win and Linux.
Comment 6 Alexander Pavlov (apavlov) 2012-05-24 08:50:00 PDT
(In reply to comment #5)
> OK, I get the point. This works as intended, since on Mac, Cmd-[ is a standard Chrome shortcut to navigate back to the previous page (and Cmd-] navigates forward in the history). This works the same way as Alt-Left/Right on Win and Linux.

Oops, we seem to intercept this shortcut, but not quite...
Comment 7 Alexander Pavlov (apavlov) 2012-05-25 04:09:35 PDT
Created attachment 144040 [details]
Patch
Comment 8 Vsevolod Vlasov 2012-05-25 05:20:39 PDT
Comment on attachment 144040 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144040&action=review

> Source/WebCore/inspector/front-end/InspectorView.js:46
> +    this._filteredKeyIdentifiers = ["U+005B", "U+00DB", "U+005D", "U+00DD"].keySet();

Let's create this._leftBracketKeyIdentifiers and this._rightBracketKeyIdentifiers fields and use them here and in _keyDownInternal to avoid duplicating this confusing unicode magic.

> Source/WebCore/inspector/front-end/InspectorView.js:95
> +        if (event.charCode === 91 || event.charCode === 93) {

Please add a comment saying this is checking for brackets or use some function to convert character to ascii code.

> Source/WebCore/inspector/front-end/InspectorView.js:103
> +        if (!WebInspector.isWin() || !this._filteredKeyIdentifiers.hasOwnProperty(event.keyIdentifier)) {

Please add a comment explaining this workaround (and reasoning) here.
Comment 9 Alexander Pavlov (apavlov) 2012-05-25 06:11:14 PDT
Committed r118520: <http://trac.webkit.org/changeset/118520>
Comment 10 Paul Irish 2012-08-02 08:11:24 PDT
*** Bug 84092 has been marked as a duplicate of this bug. ***