Bug 154719

Summary: Web Inspector: Increase clickable area of the console prompt
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Image] Before/after
none
Patch
timothy: review-, timothy: commit-queue-
Patch
timothy: review+
Patch
commit-queue: commit-queue-
Patch none

Description Nikita Vasilyev 2016-02-25 22:46:48 PST
Created attachment 272300 [details]
[Image] Before/after

Currently, only the middle part of the console prompt is clickable.
When I click on ">" icon or the white space just below or above
the CodeMirror element, the console prompt loses focus. Instead,
it should keep the focus (or focus on the prompt, if it wasn't
focused before).
Comment 1 Radar WebKit Bug Importer 2016-02-25 22:47:01 PST
<rdar://problem/24854538>
Comment 2 Nikita Vasilyev 2016-02-25 22:52:06 PST
Created attachment 272301 [details]
Patch
Comment 3 Timothy Hatcher 2016-02-26 09:10:09 PST
Comment on attachment 272301 [details]
Patch

Not a patch. Is an image.
Comment 4 Nikita Vasilyev 2016-02-26 14:18:25 PST
Created attachment 272370 [details]
Patch

Whoops. Now it's a patch.
Comment 5 Timothy Hatcher 2016-02-26 14:20:03 PST
Comment on attachment 272370 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/QuickConsole.css:57
> +    pointer-events: none;

Why is this needed?

> Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:113
> +        requestAnimationFrame(() => this.prompt.focus());

Why does this need a requestAnimationFrame?
Comment 6 Nikita Vasilyev 2016-02-26 15:02:12 PST
Comment on attachment 272370 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/QuickConsole.css:57
>> +    pointer-events: none;
> 
> Why is this needed?

In _handleMouseDown I do this to avoid capturing all the mousedown events from CodeMirror:

    if (event.target !== this.element)

If I don't use

    .quick-console > .console-prompt {pointer-events: none}

event.target could either be .quick-console or .console-prompt.
Setting `pointer-events: none` makes event.target to be always .quick-console.

>> Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:113
>> +        requestAnimationFrame(() => this.prompt.focus());
> 
> Why does this need a requestAnimationFrame?

Without it, the prompt loses focus right after it gets it.
However, event.preventDefault() seems like a better solution.
Comment 7 Timothy Hatcher 2016-02-26 21:12:58 PST
Comment on attachment 272370 [details]
Patch

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

>>> Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:113
>>> +        requestAnimationFrame(() => this.prompt.focus());
>> 
>> Why does this need a requestAnimationFrame?
> 
> Without it, the prompt loses focus right after it gets it.
> However, event.preventDefault() seems like a better solution.

Yeah, lets try with event.preventDefault() instead.
Comment 8 Joseph Pecoraro 2016-02-26 21:34:57 PST
Comment on attachment 272370 [details]
Patch

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

>>> Source/WebInspectorUI/UserInterface/Views/QuickConsole.css:57
>>> +    pointer-events: none;
>> 
>> Why is this needed?
> 
> In _handleMouseDown I do this to avoid capturing all the mousedown events from CodeMirror:
> 
>     if (event.target !== this.element)
> 
> If I don't use
> 
>     .quick-console > .console-prompt {pointer-events: none}
> 
> event.target could either be .quick-console or .console-prompt.
> Setting `pointer-events: none` makes event.target to be always .quick-console.

When adding something like this there should really be a comment in the ChangeLog, as it is non-obvious.

> Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:42
> +        this.element.addEventListener("mousedown", this._handleMouseDown.bind(this), false);

Style: We have been leaving off the "false" on addEventListener calls that use the normal bubbling phase.
Comment 9 Nikita Vasilyev 2016-02-26 21:54:30 PST
Created attachment 272402 [details]
Patch
Comment 10 WebKit Commit Bot 2016-02-26 21:55:43 PST
Comment on attachment 272402 [details]
Patch

Rejecting attachment 272402 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 272402, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
ng file Source/WebInspectorUI/ChangeLog
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file Source/WebInspectorUI/ChangeLog.rej
patching file Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
Hunk #1 FAILED at 39.
Hunk #2 FAILED at 110.
2 out of 2 hunks FAILED -- saving rejects to file Source/WebInspectorUI/UserInterface/Views/QuickConsole.js.rej

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-queues.webkit.org/results/889130
Comment 11 Nikita Vasilyev 2016-02-26 22:46:52 PST
Created attachment 272410 [details]
Patch
Comment 12 WebKit Commit Bot 2016-02-26 23:44:23 PST
Comment on attachment 272410 [details]
Patch

Clearing flags on attachment: 272410

Committed r197245: <http://trac.webkit.org/changeset/197245>
Comment 13 WebKit Commit Bot 2016-02-26 23:44:27 PST
All reviewed patches have been landed.  Closing bug.