diff --git a/.yarn/versions/63262d25.yml b/.yarn/versions/63262d25.yml new file mode 100644 index 0000000000..242518bd25 --- /dev/null +++ b/.yarn/versions/63262d25.yml @@ -0,0 +1,45 @@ +releases: + "@radix-ui/react-accessible-icon": patch + "@radix-ui/react-accordion": patch + "@radix-ui/react-alert-dialog": patch + "@radix-ui/react-announce": patch + "@radix-ui/react-arrow": patch + "@radix-ui/react-aspect-ratio": patch + "@radix-ui/react-avatar": patch + "@radix-ui/react-checkbox": patch + "@radix-ui/react-collapsible": patch + "@radix-ui/react-collection": patch + "@radix-ui/react-context-menu": patch + "@radix-ui/react-dialog": patch + "@radix-ui/react-dismissable-layer": patch + "@radix-ui/react-dropdown-menu": patch + "@radix-ui/react-focus-scope": patch + "@radix-ui/react-form": patch + "@radix-ui/react-hover-card": patch + "@radix-ui/react-label": patch + "@radix-ui/react-menu": patch + "@radix-ui/react-menubar": patch + "@radix-ui/react-navigation-menu": patch + "@radix-ui/react-popover": patch + "@radix-ui/react-popper": patch + "@radix-ui/react-portal": patch + "@radix-ui/react-primitive": patch + "@radix-ui/react-progress": patch + "@radix-ui/react-radio-group": patch + "@radix-ui/react-roving-focus": patch + "@radix-ui/react-scroll-area": patch + "@radix-ui/react-select": patch + "@radix-ui/react-separator": patch + "@radix-ui/react-slider": patch + "@radix-ui/react-slot": patch + "@radix-ui/react-switch": patch + "@radix-ui/react-tabs": patch + "@radix-ui/react-toast": patch + "@radix-ui/react-toggle": patch + "@radix-ui/react-toggle-group": patch + "@radix-ui/react-toolbar": patch + "@radix-ui/react-tooltip": patch + "@radix-ui/react-visually-hidden": patch + +declined: + - primitives diff --git a/packages/react/slot/src/Slot.tsx b/packages/react/slot/src/Slot.tsx index c222b1d7f0..070284fac2 100644 --- a/packages/react/slot/src/Slot.tsx +++ b/packages/react/slot/src/Slot.tsx @@ -62,11 +62,16 @@ const SlotClone = React.forwardRef((props, forwardedRef) => if (React.isValidElement(children)) { const childrenRef = getElementRef(children); - return React.cloneElement(children, { + const props = { ...mergeProps(slotProps, children.props), - // @ts-ignore - ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef, - }); + }; + + // do not pass ref to React.Fragment for React 19 compatibility + if (children.type !== React.Fragment) { + props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef; + } + + return React.cloneElement(children, props); } return React.Children.count(children) > 1 ? React.Children.only(null) : null;