Bug 192123 - Web Inspector: Styles: editing focus lost when inspector is blurred
Summary: Web Inspector: Styles: editing focus lost when inspector is blurred
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: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-28 16:14 PST by Devin Rousso
Modified: 2018-12-21 16:16 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.37 KB, patch)
2018-12-21 14:45 PST, Nikita Vasilyev
hi: review+
Details | Formatted Diff | Diff
[Video] With patch applied (1.26 MB, video/quicktime)
2018-12-21 14:55 PST, Nikita Vasilyev
no flags Details
Patch (2.23 KB, patch)
2018-12-21 15:38 PST, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2018-11-28 16:14:43 PST
* STEPS TO REPRODUCE:
1. inspect any page
2. show the Elements tab
3. start editing the name of any CSS property
4. switch WebKit/Safari tabs
5. go back to the original WebKit/Safari tab
 => editing ability lost (border styling is no longer present and the text is still selected, but no longer editable)
Comment 1 Radar WebKit Bug Importer 2018-12-17 21:34:02 PST
<rdar://problem/46800966>
Comment 2 Nikita Vasilyev 2018-12-21 14:45:55 PST
Created attachment 357981 [details]
Patch

After a couple of weeks trying something complex, I discovered a simple and elegant solution!
Comment 3 Nikita Vasilyev 2018-12-21 14:55:31 PST
Created attachment 357984 [details]
[Video] With patch applied
Comment 4 Devin Rousso 2018-12-21 15:00:53 PST
Comment on attachment 357981 [details]
Patch

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

r=me, awesome!

> Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js:217
> +        if (!document.hasFocus())

I think a "safer" approach may be to check that the active element is still this element, meaning that we did a blur without moving the focus (e.g. the entire window lost focus)

    if (document.activeElement === this._element)
Comment 5 Nikita Vasilyev 2018-12-21 15:38:05 PST
Comment on attachment 357981 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js:217
>> +        if (!document.hasFocus())
> 
> I think a "safer" approach may be to check that the active element is still this element, meaning that we did a blur without moving the focus (e.g. the entire window lost focus)
> 
>     if (document.activeElement === this._element)

Ooh, I like it!
Comment 6 Nikita Vasilyev 2018-12-21 15:38:30 PST
Created attachment 357990 [details]
Patch
Comment 7 WebKit Commit Bot 2018-12-21 16:16:29 PST
Comment on attachment 357990 [details]
Patch

Clearing flags on attachment: 357990

Committed r239527: <https://trac.webkit.org/changeset/239527>
Comment 8 WebKit Commit Bot 2018-12-21 16:16:31 PST
All reviewed patches have been landed.  Closing bug.