Bug 149223

Summary: Web Inspector: search shortcut in split console moves focus to search box, but doesn't show caret
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, hello, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
video of repro
none
patch
none
Patch none

Description BJ Burg 2015-09-16 10:52:26 PDT
Created attachment 261320 [details]
video of repro

STEPS TO REPRODUCE:

* Open split console (ESC)
* Click in the quick console, type stuff
* Use find shortcut (CMD+F)

EXPECTED:

* Search box should be lit up and have blinking caret

ACTUAL:

* Search box is lit up, but has no caret.
Comment 1 Radar WebKit Bug Importer 2015-09-16 10:53:04 PDT
<rdar://problem/22722755>
Comment 2 João Oliveira 2015-09-22 10:55:29 PDT
this bug is also reproducible on the main console tab, and even when nothing is typed on the quick console, when the find shortcut (CMD+F) is pressed, the carret fails to move to the search bar
Comment 3 João Oliveira 2015-09-23 05:11:17 PDT
the previous comment behaviour happens only when text is typed on the search box and then cleared, after that search box no longer gains focus when pressing CMD+F, so:

STEPS TO REPRODUCE:

* Click in the console tab
* Use find shortcut (CMD+F)
* type stuff on the searchbox
* clear text written
* Use find shortcut (CMD+F)

EXPECTED:

* Search box should be lit up and have blinking caret

ACTUAL:

* Search box is lit up, but has no caret.
Comment 4 João Oliveira 2015-09-23 05:28:53 PDT
Created attachment 261819 [details]
patch
Comment 5 BJ Burg 2015-09-23 09:41:36 PDT
Comment on attachment 261819 [details]
patch

Hi, please re-upload without whitespace changes to the changelog. You may need to change your editor settings to be less aggressive.
Comment 6 Joseph Pecoraro 2015-09-23 09:56:31 PDT
Comment on attachment 261819 [details]
patch

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

r- just to see a new version of the patch.

> Source/WebInspectorUI/ChangeLog:9
> +        When pressing console find shortcut (CMD+F) SearchBar now checks if there's text on _searchInput
> +        if so text is selected, if the textbox is empty, textbox gains focus

Nit: End in a period.

> Source/WebInspectorUI/ChangeLog:150
> -        is selected and not updating focused element. 
> +        is selected and not updating focused element.

You should drop all the whitespace changes below your additions at the top.

> Source/WebInspectorUI/UserInterface/Views/SearchBar.js:64
> +        if (this._searchInput.value.length == 0)

Style: We use `===` where possible, but in the case of 0 we would just use `!`. E.g. "if (!this._searchInput.value.length)"

> Source/WebInspectorUI/UserInterface/Views/SearchBar.js:67
> +            this._searchInput.focus();
> +        else
> +            this._searchInput.select();

So it turns out that this is an engine bug. Calling select in this case should show the caret and isn't.

I'd prefer if there was a comment here that we are working around a WebKit bug. I filed one, so you can add:

    // FIXME: Workaround for: <https://webkit.org/b/149504> Caret missing from <input> after clearing text and calling select()
Comment 7 João Oliveira 2015-09-23 11:11:31 PDT
Created attachment 261832 [details]
Patch
Comment 8 WebKit Commit Bot 2015-09-28 14:45:05 PDT
Comment on attachment 261832 [details]
Patch

Clearing flags on attachment: 261832

Committed r190285: <http://trac.webkit.org/changeset/190285>
Comment 9 WebKit Commit Bot 2015-09-28 14:45:08 PDT
All reviewed patches have been landed.  Closing bug.