mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
When the shared <Tooltip> appeared inside a modal (combo editor) or any ancestor with overflow:hidden/auto, long labels were clipped — the absolute-positioned <span> stayed inside the modal's stacking context. Render the tooltip via createPortal to document.body by default (usePortal prop, defaults to true). Coordinates are computed from the trigger's getBoundingClientRect on each show and written directly to the tooltip ref's .style — that avoids the cascading-render warning that setState-inside-effect triggers, while still doing one synchronous measure-and-position pass before the user sees any flicker. Coordinates are clamped to the viewport bounds so a trigger near the right edge produces a tooltip that stays on-screen instead of bleeding off. Adds an optional multiline prop that swaps the legacy whitespace-nowrap clamp for max-w-xs whitespace-normal break-words for explanation strings (combo strategy help, etc.). Backward compat: existing call sites do not need to change; the portal + clamp behavior is transparent to consumers.