Bug 149195

Summary: Web Inspector: Command-Enter in Debugger should show a popover with evaluation result
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, hi, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Animated GIF] With the patch applied
none
[Animated GIF] Cmd-Enter shows type info popovers
none
WIP
nvasilyev: review-, nvasilyev: commit-queue-
Patch
none
Patch
bburg: commit-queue-
Patch none

Description Nikita Vasilyev 2015-09-15 16:14:45 PDT
I've been using Command-Enter in Debugger (https://bugs.webkit.org/show_bug.cgi?id=148368) for a few days and I'm not very satisfied.

I think Command-Enter should show the exact same popover as on hover. The current behavior, evaluating in the console, is too disconnected 
from the source code and requires an extra mental effort to keep the context.
Comment 1 Radar WebKit Bug Importer 2015-09-15 16:15:35 PDT
<rdar://problem/22710660>
Comment 2 Nikita Vasilyev 2015-09-15 16:21:36 PDT
Created attachment 261257 [details]
[Animated GIF] With the patch applied

Command-Enter shows the popover.
Comment 3 Nikita Vasilyev 2015-09-15 16:35:19 PDT
Created attachment 261258 [details]
[Animated GIF] Cmd-Enter shows type info popovers

I also accidentally improved keyboard navigation for type profiler. Command-Enter shows popovers with type information too.
Comment 4 Nikita Vasilyev 2015-09-15 16:37:30 PDT
Created attachment 261259 [details]
WIP
Comment 5 Nikita Vasilyev 2015-09-16 07:28:00 PDT
Created attachment 261305 [details]
Patch

Currenty, the only way to display the popover is to hover over the text with a mouse cursor. Provide a way to display it via a keyboard shortcut, Command-Enter.
Comment 6 Nikita Vasilyev 2015-09-16 07:29:39 PDT
Created attachment 261306 [details]
Patch
Comment 7 BJ Burg 2015-10-18 16:24:50 PDT
Comment on attachment 261306 [details]
Patch

Oops, this patch has been gathering dust far too long, sorry about that. I don't know the CodeMirror integrations well enough to review this. Joe or Tim (or Devin), can you take a look?
Comment 8 Joseph Pecoraro 2015-10-20 14:10:12 PDT
Comment on attachment 261306 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:593
> +WebInspector.CodeMirrorTokenTrackingController.TriggeredBy = {
> +    Keyboard: "keyboard",
> +    Hover: "hover"
> +};

Seems this would add complexity for a very hard to discover feature. Is there some way we can make this more discoverable, otherwise I fear it wouldn't be used much?
Comment 9 Nikita Vasilyev 2015-10-21 21:58:11 PDT
(In reply to comment #8)
> Comment on attachment 261306 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=261306&action=review
> 
> > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:593
> > +WebInspector.CodeMirrorTokenTrackingController.TriggeredBy = {
> > +    Keyboard: "keyboard",
> > +    Hover: "hover"
> > +};
> 
> Seems this would add complexity for a very hard to discover feature. Is
> there some way we can make this more discoverable, otherwise I fear it
> wouldn't be used much?

I don't think it's that different from the rest of keyboard shortcuts. Also, Command-Enter already evaluates selected console message: https://twitter.com/ELV1S/status/636431257379864576.

Eventually, we will have a page with all shortcuts. I'll also write a blog post, too.

I think this shortcut isn't that hard to remember. Certainly easier than Chrome's Control-Shift-E, which evaluates selection in the console.

I don't think we should give up on keyboard accessability only because it adds complexity. This patch levereges existing mouse over handling.

I had to add WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard to avoid hiding the popover on mouse move. When we show the popover on mouse hover, we hide it when there is a mouse movement outside of evaluated token. It didn't work well with Command-Enter and I had to add WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard.
Comment 10 Nikita Vasilyev 2015-10-21 22:00:43 PDT
Created attachment 263793 [details]
Patch

Rebaselined.
Comment 11 WebKit Commit Bot 2015-10-23 10:11:46 PDT
Comment on attachment 263793 [details]
Patch

Clearing flags on attachment: 263793

Committed r191496: <http://trac.webkit.org/changeset/191496>
Comment 12 WebKit Commit Bot 2015-10-23 10:11:52 PDT
All reviewed patches have been landed.  Closing bug.