feat(ui): add Tooltip primitive to @infrahub/ui#9496
Open
pa-lem wants to merge 1 commit into
Open
Conversation
Ports the react-aria Tooltip into @infrahub/ui (tailwind-variants), one of the shared/components/ui primitives slated for migration per dev/knowledge/frontend/design-system.md.
Contributor
There was a problem hiding this comment.
2 issues found across 4 files
Confidence score: 3/5
- There is some merge risk because a medium-severity, high-confidence issue in
frontend/packages/ui/src/components/tooltip/tooltip.tsxcan cause composedclassNamestyles to be overwritten, which may drop tooltip variant/animation behavior in the UI. - A second issue in
frontend/packages/ui/src/components/tooltip/tooltip.tsxuses a falsy check formessage, so valid ReactNode values like0won’t render a tooltip; this is user-facing but lower severity. - Pay close attention to
frontend/packages/ui/src/components/tooltip/tooltip.tsx- prop spread/className merge order andmessageconditional rendering can both affect visible tooltip behavior.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/packages/ui/src/components/tooltip/tooltip.tsx">
<violation number="1" location="frontend/packages/ui/src/components/tooltip/tooltip.tsx:31">
P2: Using a falsy check on `message` hides valid ReactNode values (e.g. `0`) and skips rendering the tooltip.</violation>
<violation number="2" location="frontend/packages/ui/src/components/tooltip/tooltip.tsx:47">
P2: `className` composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
Re-trigger cubic
|
|
||
| /** Accessible tooltip. Wraps a trigger child and shows `message` on hover/focus. */ | ||
| export function Tooltip({ children, message, isOpen, onOpenChange, ...props }: TooltipProps) { | ||
| if (!message) { |
Contributor
There was a problem hiding this comment.
P2: Using a falsy check on message hides valid ReactNode values (e.g. 0) and skips rendering the tooltip.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/packages/ui/src/components/tooltip/tooltip.tsx, line 31:
<comment>Using a falsy check on `message` hides valid ReactNode values (e.g. `0`) and skips rendering the tooltip.</comment>
<file context>
@@ -0,0 +1,66 @@
+
+/** Accessible tooltip. Wraps a trigger child and shows `message` on hover/focus. */
+export function Tooltip({ children, message, isOpen, onOpenChange, ...props }: TooltipProps) {
+ if (!message) {
+ return children;
+ }
</file context>
Suggested change
| if (!message) { | |
| if (message === null || message === undefined || message === "") { |
Comment on lines
+47
to
+50
| className={composeRenderProps(props.className, (className, renderProps) => | ||
| tooltipStyles({ ...renderProps, className }), | ||
| )} | ||
| {...props} |
Contributor
There was a problem hiding this comment.
P2: className composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/packages/ui/src/components/tooltip/tooltip.tsx, line 47:
<comment>`className` composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.</comment>
<file context>
@@ -0,0 +1,66 @@
+
+ <AriaTooltip
+ offset={10}
+ className={composeRenderProps(props.className, (className, renderProps) =>
+ tooltipStyles({ ...renderProps, className }),
+ )}
</file context>
Suggested change
| className={composeRenderProps(props.className, (className, renderProps) => | |
| tooltipStyles({ ...renderProps, className }), | |
| )} | |
| {...props} | |
| {...props} | |
| className={composeRenderProps(props.className, (className, renderProps) => | |
| tooltipStyles({ ...renderProps, className }), | |
| )} |
This was referenced Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
Tooltipprimitive to the@infrahub/uidesign system — a port of the app's existing react-aria tooltip (shared/components/aria/tooltip), converted to the design system'stailwind-variantsconvention.Tooltip is one of the
shared/components/uiprimitives slated for migration into@infrahub/uiperdev/knowledge/frontend/design-system.md.Scope
Tooltipcomponent + Storybook story; exported from the barrel and as a./tooltipsubpath.Why now
It's the base dependency for a follow-up
@infrahub/graphpackage (graph-view primitives) whoseGraphControlsneeds a tooltip that isn't coupled to the app. Splitting it out keeps that change reviewable on its own.🤖 Generated with Claude Code
Summary by cubic
Adds a
Tooltipprimitive to@infrahub/ui, ported from the app’s tooltip to usetailwind-variants. No call-site changes; this unblocks@infrahub/graph’sGraphControls.Tooltipwraps a trigger child and shows amessageon hover/focus, built onreact-aria-components.@infrahub/ui/tooltip.Written for commit 25ad2e9. Summary will update on new commits.