Bug 1396517

Summary: Undismisable tooltip after Guide Me menu
Product: [oVirt] ovirt-engine Reporter: Lukas Svaty <lsvaty>
Component: Frontend.WebAdminAssignee: Greg Sheremeta <gshereme>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: bugs, gklein, jbelka, lleistne, oourfali, vszocs
Target Milestone: ovirt-4.1.0-betaFlags: rule-engine: ovirt-4.1+
rule-engine: planning_ack+
rule-engine: devel_ack+
gklein: testing_ack+
Target Release: 4.1.0.2   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:41:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: UX RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Svaty 2016-11-18 14:24:13 UTC
Description of problem:
When adding entities with GuideMe menu, when we get to configure storage tooltip appears that cannot be dismissed until storage is added.

Version-Release number of selected component (if applicable):
4.1.0-0.0.master.20161117231327.gitdbe2e8a.el7.centos.noarch

How reproducible:
100%

Steps to Reproduce:
1. Click Guide Me
2. Click Configure Storage in the last step


Actual results:
Tooltip appears ', There should be at least 1 active host in the datacenter' even if there are active hosts.

Expected results:
Should appear only on hover over

Comment 1 Oved Ourfali 2016-11-20 06:32:39 UTC
Greg, please also check if 4.0 is affected.

Comment 2 Greg Sheremeta 2016-11-21 19:47:32 UTC
This is a typical issue that happens with tooltips. They are hidden when the mouse leaves an element. If you click and the click caused the element to leave the page, there is no way for the mouse to leave the element -- the element is gone.

To solve this in the past, IIRC, we globally listened for clicks and hid all tooltips upon any click.

@Vojtech, do you recall seeing this? How would you like me to approach solving this?

Comment 3 Vojtech Szocs 2016-11-22 16:43:05 UTC
(In reply to Greg Sheremeta from comment #2)
> This is a typical issue that happens with tooltips. They are hidden when the
> mouse leaves an element. If you click and the click caused the element to
> leave the page, there is no way for the mouse to leave the element -- the
> element is gone.
> 
> To solve this in the past, IIRC, we globally listened for clicks and hid all
> tooltips upon any click.

Before tooltip refactor, we had a global (GWT RootPanel) click handler to hide all tooltip instances, see [1] line 425.

[1] https://gerrit.ovirt.org/#/c/65566/17/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/tooltip/Tooltip.java

We need to add similar behavior to post-tooltip-refactor code.

> @Vojtech, do you recall seeing this? How would you like me to approach
> solving this?

One approach is to add equivalent global click handler that calls ElementTooltipUtils#hideAllTooltips. [Note that `hideAllTooltips` only affects tooltips whose DOM elements are currently attached to live DOM.]

Another approach is to modify WidgetTooltip: in decorateWidget method, add widget click handler that calls WidgetTooltip#hide.

I'd suggest to go with the former approach, which covers all kinds of tooltips (both ones created directly via ElementTooltipUtils & ones created via WidgetTooltip).

The class to host relevant code should reside in ElementTooltipUtils. [Also, please use RootLayoutPanel instead of RootPanel.]

Example code:

  // ElementTooltipUtils.java

  public static class TooltipHideOnRootPanelClick {

    public TooltipHideOnRootPanelClick() {
      RootLayoutPanel.get().addDomHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          ElementTooltipUtils.hideAllTooltips();
        }
      }, ClickEvent.getType());
    }

  }

To put above code into effect, bind it as eager singleton:

  // BaseSystemModule.java

  bind(ElementTooltipUtils.TooltipHideOnRootPanelClick.class).asEagerSingleton();

Comment 4 Greg Sheremeta 2016-12-14 01:44:54 UTC
*** Bug 1401581 has been marked as a duplicate of this bug. ***

Comment 5 Jiri Belka 2017-01-12 12:02:45 UTC
ok, ovirt-engine-webadmin-portal-4.1.0-0.4.master.20170111151514.git3d62579.el7.centos.noarch