Skip to content

Lib.hoverElement

Lib › hoverElement

Type: (this: void, params: HoverElementParams) => Promise<void>

Moves the mouse pointer to the center of an element using **trusted** Electron pointer input, then polls until the element actually matches :hover.

Because the move is trusted (see Lib.moveMouse), the real :hover state takes effect in the CSS engine — real theme var() values and real compositing — instead of a hand-simulated cascade. It polls the live element.matches(':hover') state (not a fixed delay), so it is robust under shared-instance load. It targets the single shared window's **global** pointer, so only one element is hovered at a time.

**Desktop only — it throws on mobile**, deliberately: touch input has no hover state, so there is nothing faithful to inject. A silent no-op would leave a test asserting against a hover that never happened, which is the exact false-confidence failure trusted input exists to prevent. Branch on Platform.isDesktopApp, or drive the element with Lib.clickElement.