Skip to content

fix(tooltip): preserve ButtonGroup context for tooltip-wrapped buttons - #6730

Open
wanxiankai wants to merge 4 commits into
heroui-inc:v3from
wanxiankai:fix/button-group-tooltip-trigger
Open

fix(tooltip): preserve ButtonGroup context for tooltip-wrapped buttons#6730
wanxiankai wants to merge 4 commits into
heroui-inc:v3from
wanxiankai:fix/button-group-tooltip-trigger

Conversation

@wanxiankai

@wanxiankai wanxiankai commented Jul 25, 2026

Copy link
Copy Markdown

Summary

Verification

  • pnpm typecheck:react
  • pnpm lint:react
  • pnpm build
  • SSR regression checks for every supported wrapper, nested and fragment forwarding, and internal-prop leakage.

@wanxiankai
wanxiankai requested a review from jrgarciadev as a code owner July 25, 2026 05:18
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@wanxiankai is attempting to deploy a commit to the HeroUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
heroui Ready Ready Preview Jul 30, 2026 4:17am
heroui-sb Ready Ready Preview Jul 30, 2026 4:17am

Request Review

@wingkwong wingkwong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please verify locally once first before making a PR. The changes failed all QA.

@wanxiankai

Copy link
Copy Markdown
Author

Thanks for checking. You're right — the first version leaked the internal ButtonGroup marker into the exported Tooltip type, which caused the QA TypeScript/build failures:

TS4023: Exported variable 'Tooltip' has or is using name 'BUTTON_GROUP_CHILD'...

I pushed 5fb754d to keep the marker prop internal to the Tooltip implementation while preserving the same behavior. The new QA run is currently marked action_required before jobs execute, so I can't see the updated TypeScript/build result yet from my fork. Could you approve/re-run the workflow when you have a chance?

@wingkwong wingkwong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You may verify by running pnpm typecheck and pnpm build first.

Prevent BUTTON_GROUP_CHILD from leaking into generated declarations.

Verified with pnpm typecheck and pnpm build.
@wanxiankai

Copy link
Copy Markdown
Author

Thanks — I reproduced the issue locally on 5fb754d. pnpm typecheck still failed with the same TS4023 because TooltipRoot's inferred function signature included the internal computed marker prop.

I pushed d24d501 to explicitly expose TooltipRoot as React.FC<TooltipRootProps> while keeping ButtonGroupChildProps only in the implementation signature. The generated declaration now contains declare const TooltipRoot: React.FC<TooltipRootProps>; and no BUTTON_GROUP_CHILD reference.

Local verification now passes:

  • pnpm typecheck
  • pnpm build
  • pnpm lint:react
  • pnpm exec prettier --check packages/react/src/components/tooltip/tooltip.tsx

The new QA workflow run 30183835766 completed with no jobs, so it still needs approval/re-run from a maintainer.

@wanxiankai
wanxiankai requested a review from wingkwong July 26, 2026 02:04
@pkg-pr-new

pkg-pr-new Bot commented Jul 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@heroui/react@6730
npm i https://pkg.pr.new/@heroui/styles@6730

commit: 2a8a7ec

@wingkwong wingkwong changed the title fix(tooltip): preserve ButtonGroup context for tooltip-wrapped buttons (fix #6516) fix(tooltip): preserve ButtonGroup context for tooltip-wrapped buttons Jul 30, 2026

@wingkwong wingkwong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The scope is too narrow as you only cover Tooltip. Also it is a generic wrapper and should not know anything about Button or ButtonGroup internals. If the intent is "transparent wrappers forward unknown props to their first child", it should be implemented generically without importing Button.

Implement generic child prop forwarding for transparent trigger wrappers without coupling Tooltip to Button internals.
@wanxiankai

Copy link
Copy Markdown
Author

Thanks for the feedback. Updated in 2a8a7ec.

  • Removed Tooltip's Button/ButtonGroup imports and special-case traversal.
  • Added a generic internal child-prop forwarding mechanism for transparent trigger roots.
  • Applied it across Tooltip, Dropdown, Popover, Modal, Drawer, and AlertDialog, with Button consuming the forwarded props.
  • ButtonGroup only marks opted-in direct children, preserving direct-child semantics and preventing internal props from reaching DOM elements or separators.
  • Added ButtonGroup stories covering Tooltip and Dropdown wrappers.

Verified with pnpm typecheck:react, pnpm lint:react, pnpm build, and SSR checks covering every supported wrapper, nested wrappers, fragments, and internal-prop leakage.

Could you please take another look?

@wanxiankai
wanxiankai requested a review from wingkwong July 30, 2026 05:55
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.

[BUG] - ButtonGroup variant/size props don't propagate to Button when child is wrapped in Tooltip

2 participants