Skip to content

obsidian/functions/setTooltip

Mock of Obsidian’s setTooltip.

Function Description
setTooltip Attaches a tooltip to an element, as Obsidian does: the text goes to the element’s aria-label, which is what Obsidian’s hover handler reads, and each option that is set goes to a data-tooltip-* attribute the handler reads too. A placement of bottom is the default and writes nothing, and a falsy delay or gap writes nothing. An attribute is never removed, so options left out of a later call keep the earlier call’s values, as in Obsidian. Obsidian also re-shows the tooltip when it is on screen for this element at the time of the call; the mock shows no tooltips, so there is nothing to re-show.