fix: add collision padding to tooltips for safe viewport margins#456
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
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.
Adds a default
collisionPaddingof 8px to theTooltipContentprimitive so tooltips keep a safe margin from viewport edges instead of rendering flush against them. This matches the existing convention inpopover.tsxanddropdown-menu.tsx, which already defaultcollisionPadding. The value remains overridable per-usage.Closes EN-653.
🤖 Generated with Claude Code