Opened 9 years ago

Closed 8 years ago

#11504 closed defect (fixed)

dijit.Tooltip is positioned over hovered child element, not the connectId element

Reported by: Thomas Bachem Owned by: bill
Priority: high Milestone: 1.8
Component: Dijit Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description

We are using dijit.Tooltip on elements than contain child elements.

Example:

<div id="parent" title="My tooltip">
    <div id="foo">Foo</div>
    <div id="bar">Bar</div>
</div>

When hovering over the element, the tooltip is positioned over the element the mouse first entered (e.g. ID "foo"), not always the parent element (ID "parent") that dijit.Tooltip was applied to.

This can lead to confusion a) depending on the direction the element is entered by the cursor and the position of the child elements b) because sometimes a mouse enter event is triggered directly on a child element before it was triggered on the parent element if one is moving the cursor fast (at least in Firefox 3.6.7).

It would be nice to have an option to tell dijit.Tooltip if this behaviour is wanted or not.

Change History (4)

comment:1 Changed 9 years ago by bill

Can you attach an a test case using the Attach File button? Your code above isn't creating a dijit.Tooltip.

comment:2 Changed 8 years ago by bill

Looks like Tooltip._onHover() is referencing evt.target, which is wrong:

if(!this._showTimer){
	var target = e.target;
	this._showTimer = setTimeout(lang.hitch(this, function(){this.open(target)}), this.showDelay);
}

It should be using the node that was connected to. I guess that needs to be passed in to the function, as it doesn't seem available through the event object.

Just need to add an automated test along with the fix.

comment:3 Changed 8 years ago by bill

Milestone: tbd1.8
Owner: set to bill
Status: newassigned
Summary: dijit.Tooltip is positioned over hovered child element, not the parent element that defines the tooltipdijit.Tooltip is positioned over hovered child element, not the connectId element
Type: enhancementdefect

I'll check in a fix. I consider the current behavior a bug.

comment:4 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

In [27525]:

Fix mis-positioning of tooltip when the mousover event's target is a child node rather than the Tooltip's anchor node (i.e. the node specified by connectId). Fixes #11504 !strict

Note: See TracTickets for help on using tickets.