Skip to content

✨ feat: add disabled and asOverlay modes to Tooltip - #719

Open
futjesus wants to merge 1 commit into
mainfrom
feat/tooltip-disabled-overlay
Open

futjesus wants to merge 1 commit into
mainfrom
feat/tooltip-disabled-overlay

Conversation

@futjesus

@futjesus futjesus commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • disabled: keeps the Radix tree mounted and forces the tooltip closed instead of unwrapping the children, so toggling it while the user types in a field does not remount the field. Volumes (NameTakenTooltip) and vpc (LockedFieldTooltip) implemented an enabled flag locally, the vpc one by returning the children untouched (which remounts them).
  • asOverlay: renders an invisible, positionable trigger over the children instead of wrapping them, for controls that cannot be wrapped or are disabled (native pointer events do not fire on disabled buttons/inputs). overlayClassName positions the hit area (whole control by default; e.g. right-0 top-7 h-10 w-8 to cover only the right edge of an input so typing still works). overlayLabel names it for assistive technology when content is not a string. wrapperClassName styles the relative wrapper.

Default behaviour is unchanged.

Test plan

  • New tests: disabled never opens, children not remounted when toggled, overlay trigger named and positioned, overlay hidden while disabled, axe
  • npx vitest run lib/components/Tooltip, lint, types, prettier
  • Storybook: TooltipDisabled, OverlayOnField

`disabled` keeps the Radix tree mounted and forces the tooltip closed
instead of unwrapping the children, so toggling it while the user types
in a field (volumes NameTakenTooltip, vpc LockedFieldTooltip) does not
remount the field and drop its focus.

`asOverlay` renders an invisible, positionable trigger over the children
instead of wrapping them, for controls that cannot be wrapped or are
disabled: native pointer events do not fire on disabled buttons and inputs,
so a tooltip explaining why a field is locked needs its own hit area.
`overlayClassName` positions it (whole control by default), and
`overlayLabel` names it for assistive technology when the content is not
plain text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant