Bug 182661

Summary: Web Inspector: Styles: Completion popover should hide when resizing or scrolling
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Animated GIF] Bug
none
[Animated GIF] WIP
none
Patch
timothy: review+
[Animated GIF] With patch applied
none
Patch none

Description Nikita Vasilyev 2018-02-09 15:57:11 PST
Created attachment 333530 [details]
[Animated GIF] Bug

CompletionSuggestionsView's popover doesn't update when:
1. Sidebar is resized.
2. Sidebar is scrolled.
3. When web page is reloaded by pressing Command-R!

In "Bug 182619 - Web Inspector: Styles: Loses focus when editing a property while page is being loaded"
you can see the completion popover not hiding when the anchor node is removed from DOM.

I recently fixed "Bug 182464 - Web Inspector: Styles: completion popover doesn't hide when switching panels",
by adding a bunch of code to hide the popover when the anchor element becomes hidden.

---

Instead of fixing these issues one by one, CompletionSuggestionsView should be smarter by default.

The popover should hide when the anchor node:
- detaches from DOM.
- becomes invisible.

The popover should update its position when the anchor node moves.
Comment 1 Radar WebKit Bug Importer 2018-02-09 15:57:34 PST
<rdar://problem/37408559>
Comment 2 Nikita Vasilyev 2018-02-10 19:50:17 PST
Created attachment 333567 [details]
[Animated GIF] WIP

On the animated GIF you can see the popover still being visible when the anchor node is behind the sidebar navigation bar. It also looks jittery.

I think it's good enough to hide the popover when resizing or scrolling.
Comment 3 Nikita Vasilyev 2018-02-11 17:26:10 PST
Created attachment 333574 [details]
Patch
Comment 4 Nikita Vasilyev 2018-02-11 17:28:35 PST
Created attachment 333575 [details]
[Animated GIF] With patch applied
Comment 5 Nikita Vasilyev 2018-02-11 17:38:56 PST
> CompletionSuggestionsView's popover doesn't update when:
> 1. Sidebar is resized.
> 2. Sidebar is scrolled.
> 3. When web page is reloaded by pressing Command-R!

My patch fixes these cases.


> In "Bug 182619 - Web Inspector: Styles: Loses focus when editing a property
> while page is being loaded"
> you can see the completion popover not hiding when the anchor node is
> removed from DOM.

My patch mitigates this issue by hiding the popover. The bug with losing focus still needs to be fixed in bug 182619.

> I recently fixed "Bug 182464 - Web Inspector: Styles: completion popover
> doesn't hide when switching panels",
> by adding a bunch of code to hide the popover when the anchor element
> becomes hidden.

Again, my patch mitigates the issue by hiding the popover, but doesn't fix it completely. When switching panels, we still need to manually trigger blur event, or it's possible to continue typing in a text field of a a hidden panel :(
We can't revert bug 182464.
Comment 6 Timothy Hatcher 2018-02-14 11:57:19 PST
Comment on attachment 333574 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js:168
> +        }
> +        this.show(this._anchorBounds);

Nit: New line between these lines.
Comment 7 Nikita Vasilyev 2018-02-14 12:03:20 PST
Created attachment 333827 [details]
Patch
Comment 8 WebKit Commit Bot 2018-02-14 14:45:55 PST
Comment on attachment 333827 [details]
Patch

Clearing flags on attachment: 333827

Committed r228487: <https://trac.webkit.org/changeset/228487>
Comment 9 WebKit Commit Bot 2018-02-14 14:45:57 PST
All reviewed patches have been landed.  Closing bug.