Skip to content

fix: add collision padding to tooltips for safe viewport margins#456

Merged
drankou merged 1 commit into
mainfrom
add-tooltip-safe-margins
Jun 24, 2026
Merged

fix: add collision padding to tooltips for safe viewport margins#456
drankou merged 1 commit into
mainfrom
add-tooltip-safe-margins

Conversation

@drankou

@drankou drankou commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Adds a default collisionPadding of 8px to the TooltipContent primitive so tooltips keep a safe margin from viewport edges instead of rendering flush against them. This matches the existing convention in popover.tsx and dropdown-menu.tsx, which already default collisionPadding. The value remains overridable per-usage.

Closes EN-653.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

EN-653

@cla-bot cla-bot Bot added the cla-signed label Jun 24, 2026
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 24, 2026 2:18pm
web-tango Building Building Preview, Comment Jun 24, 2026 2:18pm

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — small, well-contained primitive default that matches the existing convention in popover.tsx and dropdown-menu.tsx.

Extended reasoning...

Overview

This PR adds a default collisionPadding={8} to the TooltipContent primitive in src/ui/primitives/tooltip.tsx so tooltips keep an 8px margin from viewport edges. The prop remains overridable per-usage via the spread props.

Security risks

None. This is a pure visual/positioning default on a Radix UI primitive wrapper — no auth, data flow, or input handling changes.

Level of scrutiny

Very low. This is a one-line config-style default on a UI primitive, with no logic changes. I verified the stated convention: popover.tsx defaults to collisionPadding={10} and dropdown-menu.tsx defaults to collisionPadding={10}, so adding a default to tooltip aligns with the established pattern (the slightly smaller 8px value is a reasonable choice for tooltips, which are typically smaller than popovers/menus).

Other factors

The bug hunting system found no bugs. The change is overridable, so any consumer that explicitly passes collisionPadding retains its current behavior. Vercel preview deployment built successfully.

@drankou drankou merged commit 2be4ee0 into main Jun 24, 2026
14 checks passed
@drankou drankou deleted the add-tooltip-safe-margins branch June 24, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants