Bug 149223 - Web Inspector: search shortcut in split console moves focus to search box, but doesn't show caret
Summary: Web Inspector: search shortcut in split console moves focus to search box, bu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-09-16 10:52 PDT by Brian Burg
Modified: 2015-09-28 14:45 PDT (History)
9 users (show)

See Also:


Attachments
video of repro (5.55 MB, video/quicktime)
2015-09-16 10:52 PDT, Brian Burg
no flags Details
patch (19.68 KB, patch)
2015-09-23 05:28 PDT, João Oliveira
no flags Details | Formatted Diff | Diff
Patch (1.75 KB, patch)
2015-09-23 11:11 PDT, João Oliveira
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian 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 Brian 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.