Opened 8 years ago

Closed 8 years ago

#12665 closed defect (fixed)

Tooltip: doesn't work on drop down Menus, or inside of Titlepane

Reported by: IngoWinter Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.0
Keywords: tooltip, titlepane Cc:
Blocked By: Blocking:

Description

Doesn't work in any Browser.

<!doctype html>
<head>
    <meta charset="utf-8">
    <title>dojo Tooltip Demo</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" href="reset.css">
    <link rel="stylesheet" href="style.css">
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djConfig="parseOnLoad: true"></script>
    <script>
        dojo.require("dijit.Tooltip");
        dojo.require("dijit.TitlePane");
    </script>
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css" />
</head>
<body class="claro">
    <div id="website">
        <h1>dojo Tooltip Demo</h1>
        <div id="tp2" dojoType="dijit.TitlePane" title="I'm a TitlePane Too">
            <img src="tooltip_trigger.gif" alt="" id="tooltip_trigger" />
            <span dojoType="dijit.Tooltip" connectId="tooltip_trigger">Krass geiler Tooltip</span>
        </div>
    </div>
</body>
</html>

Change History (3)

comment:1 Changed 8 years ago by bill

Milestone: tbd2.0
Summary: Tooltips don't work inside of TitlepanesTooltip: doesn't work inside of Titlepane

Ah right, it's because the Tooltip._setConnectIdAttr() code executes before the TitlePane.containerNode has been inserted into the DOM, andsoit can't find the <img> node via dojo.byId("tooltip_trigger").

The right thing to do is to defer the tooltip's connect code until the Tooltip.startup() call, but that might break existing apps which aren't calling Tooltip.startup(). Could run the code twice although that's ineffecient.

As a workaround you can call this after requiring Tooltip:

dojo.connect(dijit.Tooltip.prototype, "startup", function(){
	this.set("connectId", this.get("connectId"));
})

comment:2 Changed 8 years ago by bill

Milestone: 2.01.7
Owner: set to bill
Status: newassigned
Summary: Tooltip: doesn't work inside of TitlepaneTooltip: doesn't work on drop down Menus, or inside of Titlepane

Hmm, I just realized the problem is more severe in that tooltips don't create correctly when attached to a drop down menu from a DropDownButton, since they look for the attach node at a time when it's not attached to <body>.

So I changed my mind and will do this for 1.7.

comment:3 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [25500]) Fix bug in code from #9568, dealing with connecting to nodes that don't exist until the Tooltip.startup() call. This allows tooltip creation on Menus or in TitlePanes. Fixes #12665, refs #9568 !strict

Note: See TracTickets for help on using tickets.