Bug 210197 - REGRESSION (r251254): Web Inspector: Text insertion point is invisible when editing DOM nodes
Summary: REGRESSION (r251254): Web Inspector: Text insertion point is invisible when e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: Safari Technology Preview
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-08 10:09 PDT by Michael Bailey
Modified: 2020-09-04 09:01 PDT (History)
7 users (show)

See Also:


Attachments
Video showing bug (23.64 MB, video/quicktime)
2020-04-08 10:09 PDT, Michael Bailey
no flags Details
[Image] Memory issue (209.28 KB, image/png)
2020-06-16 11:27 PDT, Nikita Vasilyev
no flags Details
Patch (3.81 KB, patch)
2020-06-16 11:42 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff
[Video] With patch applied (2.71 MB, video/quicktime)
2020-06-16 11:44 PDT, Nikita Vasilyev
no flags Details
[Image] Before/after (1.30 MB, image/png)
2020-06-17 14:58 PDT, Nikita Vasilyev
no flags Details
Patch (4.01 KB, patch)
2020-09-02 12:55 PDT, Nikita Vasilyev
hi: review+
Details | Formatted Diff | Diff
Patch (4.04 KB, patch)
2020-09-02 13:54 PDT, 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 Michael Bailey 2020-04-08 10:09:11 PDT
Created attachment 395828 [details]
Video showing bug

Sometime between Safari 13.0 and 13.1, the blinking text insertion point cursor became invisible when editing DOM nodes. See attached video for an example. The insertion point is still visible as expected when editing style rules, in the console and other areas of the Inspector—it's just when editing DOM nodes that it's invisible.

This issue reproduces in the shipping Safari 13.1 (15609.1.20.111.8) and Safari Technology Preview 104 (Safari 13.2, WebKit 15610.1.8.3).
Comment 1 Radar WebKit Bug Importer 2020-04-08 16:49:48 PDT
<rdar://problem/61485409>
Comment 2 Nikita Vasilyev 2020-06-15 17:54:04 PDT
Bisecting shows that this regressed in Bug 203057 - Web Inspector: Elements: selection shouldn't be dimmed by shadow trees.
Comment 3 Nikita Vasilyev 2020-06-16 11:27:12 PDT
Created attachment 402025 [details]
[Image] Memory issue

Another issue with https://trac.webkit.org/changeset/251254 is that it introduced a layer for every DOM node.
Comment 4 Nikita Vasilyev 2020-06-16 11:42:36 PDT
Created attachment 402029 [details]
Patch
Comment 5 Nikita Vasilyev 2020-06-16 11:44:22 PDT
Created attachment 402030 [details]
[Video] With patch applied
Comment 6 Devin Rousso 2020-06-16 14:29:02 PDT
Comment on attachment 402029 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:55
> +    z-index: -1;

This reintroduces the bug that r251254 solved, which is that the selection background is shaded by the semi-transparent shadow DOM background, which is not ideal (especially when selecting something inside multiple nested shadow DOM subtrees).

Why is it that adding `z-index: 1;` causes the cursor to disappear?  That seems like the real bug here 🤔
Comment 7 Nikita Vasilyev 2020-06-16 15:29:27 PDT
(In reply to Devin Rousso from comment #6)
> Comment on attachment 402029 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=402029&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:55
> > +    z-index: -1;
> 
> This reintroduces the bug that r251254 solved, which is that the selection
> background is shaded by the semi-transparent shadow DOM background, which is
> not ideal (especially when selecting something inside multiple nested shadow
> DOM subtrees).

To a smaller extend, but yes.

> 
> Why is it that adding `z-index: 1;` causes the cursor to disappear?  That
> seems like the real bug here 🤔

This seems like a contentEditable WebKit bug although I haven't been able to make a reduction yet.
Comment 8 Nikita Vasilyev 2020-06-17 14:58:26 PDT
Created attachment 402156 [details]
[Image] Before/after

Actually, I wouldn't say it re-introduced the bug that r251254 solved. Screenshot attached. The text to background contrast of the selected item is pretty good!
Comment 9 Devin Rousso 2020-06-17 17:10:31 PDT
(In reply to Nikita Vasilyev from comment #8)
> Created attachment 402156 [details]
> [Image] Before/after
> 
> Actually, I wouldn't say it re-introduced the bug that r251254 solved. Screenshot attached. The text to background contrast of the selected item is pretty good!

I agree that it looks better than it did before r251254, but r251254 was specifically about "selection shouldn't be dimmed by shadow trees" which is still happening with this patch and is something I think we should avoid if possible.
Comment 10 Nikita Vasilyev 2020-06-17 17:39:02 PDT Comment hidden (obsolete)
Comment 11 Nikita Vasilyev 2020-09-02 12:55:02 PDT
Created attachment 407788 [details]
Patch

Updated the Changelog and rebaselined.

I think we should land this now. When "Bug 213501 - contentEditable: Text caret is invisible on position relative elements" is resolved, we should revert this change (if the memory issue in Comment 3 isn't actually an issue).
Comment 12 Devin Rousso 2020-09-02 13:29:25 PDT
Comment on attachment 407788 [details]
Patch

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

r=me

Please make a new bug for fixing the non-solid issue that's blocked by bug 213501.

> Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:47
> +    --shadow-background-color: hsla(0, 0%, 0%, 0.05);

this could use a better name, like `--shadow-subtree-background-color`

> Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:-77
> -.tree-outline.dom li > :not(.selection-area) {

(note for the future) we probably only need to do this when inside a `.shadow`
Comment 13 Nikita Vasilyev 2020-09-02 13:54:58 PDT
Created attachment 407800 [details]
Patch
Comment 14 EWS 2020-09-02 19:08:15 PDT
Committed r266499: <https://trac.webkit.org/changeset/266499>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407800 [details].
Comment 15 Nikita Vasilyev 2020-09-04 09:01:52 PDT
*** Bug 208310 has been marked as a duplicate of this bug. ***