Skip to content

Add usePortal support to Tooltip component#3320

Merged
rossnelson merged 1 commit intomainfrom
ui-tooltip-in-portal
Apr 22, 2026
Merged

Add usePortal support to Tooltip component#3320
rossnelson merged 1 commit intomainfrom
ui-tooltip-in-portal

Conversation

@rossnelson
Copy link
Copy Markdown
Collaborator

Summary

  • Adds usePortal and scrollContainer props to <Tooltip> following the same pattern Laura used for the <Menu> component
  • When usePortal is true, the tooltip renders via <Portal> anchored to the wrapper element, escaping any overflow:hidden ancestor
  • Hover state is tracked in JS (on:mouseenter/on:mouseleave) since the portal renders outside the DOM subtree
  • Falls back to the original CSS group-hover absolute positioning when usePortal is false (no breaking changes)

Test plan

  • Hover tooltips in a container with overflow:hidden — with usePortal the tooltip should appear unclipped
  • Verify all position variants (top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight) work correctly with usePortal
  • Verify existing tooltips without usePortal are unaffected
  • Test on the Deployments page where the original clipping was observed

Fixes tooltip clipping inside overflow-hidden containers by optionally
rendering via the Portal component, anchored to the wrapper element with
JS-tracked hover state.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment Apr 17, 2026 5:49pm

Request Review

@temporal-cicd
Copy link
Copy Markdown
Contributor

temporal-cicd Bot commented Apr 17, 2026

Warnings
⚠️

📊 Strict Mode: 1 error in 1 file (0.1% of 1048 total)

src/lib/holocene/tooltip.svelte (1)
  • L56:13: Type 'null' is not assignable to type '"action" | "activity" | "add-square" | "add" | "apple" | "archives" | "arrow-down" | "arrow-left" | "arrow-up" | "arrow-right" | "ascending" | "astronaut" | "batch-operation" | ... 139 more ... | "xmark-square"'.

Generated by 🚫 dangerJS against eb2b977

@rossnelson rossnelson marked this pull request as ready for review April 17, 2026 18:07
@rossnelson rossnelson requested a review from a team as a code owner April 17, 2026 18:07
@rossnelson rossnelson requested a review from GraceGardner April 17, 2026 18:07
@Alex-Tideman
Copy link
Copy Markdown
Collaborator

Might be the right time to convert Tooltip to Svelte5

Copy link
Copy Markdown
Contributor

@andrewzamojc andrewzamojc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

let wrapperElement: HTMLElement | null = null;
let isHovered = false;

$: portalPosition = ((): PortalPosition => {
Copy link
Copy Markdown
Contributor

@andrewzamojc andrewzamojc Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a pre-existing pattern so no change needed, but I wanted to put on record I think its weird to use boolean style props that can't be combined. Not the end of the world, and reads nice on the usage, but a position prop seems simpler.

@rossnelson rossnelson merged commit e7114c8 into main Apr 22, 2026
18 checks passed
@rossnelson rossnelson deleted the ui-tooltip-in-portal branch April 22, 2026 14:53
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.

3 participants