#14654 closed enhancement (fixed)
Tooltip: support multiple tooltips via one dijit.Tooltip through delegation
Reported by: | bill | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | Dijit | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Add new attributes to Tooltip allowing a single Tooltip instance to be applied to a set of nodes, and display a different Tooltip for each of them. This would make dijit.Tooltip practical for displaying tooltips for rows of a a Grid or Tree because it would eliminate the overhead of setting up event handlers per-node, and precomputing the tooltip text for each row.
Probably an API like this:
new Tooltip({ connectId: myTable, selector: "td", getContent: function(matchedNode){ return ...; /* String */} });
This example would setup delegation on a <table> node, monitoring mouseenter/mouseleave (and also focusin/focusout) on each <tr>. When the user hovered over a <tr> it would display the tooltip, but it would get the text dynamically through getContent() (or getText()?).
Will of course leverage dojo/on's delegation feature.
PS: should have something similar for context menus, perhaps creating the actual Menu widget (or at least the DOMNodes) on-demand. That would certainly be a win for TabContainer, which is currently creating a separate context menu for every closable TabButton in order to meet a11y requirements.