Skip to main content

Module tooltip

Module tooltip 

Source
Expand description

Tooltip widget.

Shows a small text popup near an anchor on hover; see tooltip.rs. Tooltip widget — wraps an arbitrary anchor [Dom] and shows a small text popup near it while the pointer hovers, hiding it again on leave.

§Implementation note (CSS-based, see TODO2 below)

The drop-down popup path (open_menu_for_hit_node / MenuPopupPosition) is built for menus — a list of clickable MenuItems — not arbitrary text shown next to an anchor, and it would also require a live window/hit-test to verify. This widget therefore takes the simpler, fully-compilable and self-contained CSS route the recipe allows: the tip is an absolutely- positioned child of a position: relative wrapper, hidden by default (opacity: 0) and revealed on MouseEnter / hidden on MouseLeave via set_css_property. No user callbacks are needed — the show/hide handlers are internal.

TODO2: this is a CSS simplification of a “real” floating popover. The tip is placed at a fixed offset below the anchor (it does not measure the anchor’s height, flip when near a screen edge, or escape an overflow: hidden ancestor). A future revision could route through the window-popup / menu popup path for true screen-anchored positioning once that is runtime- verifiable.

Key types: [Tooltip].

Structs§

Tooltip
A tooltip: an anchor Dom plus the text shown on hover.