diff --git a/packages/@headlessui-react/src/components/transition/transition.tsx b/packages/@headlessui-react/src/components/transition/transition.tsx index 42d3485be7..15d07b881d 100644 --- a/packages/@headlessui-react/src/components/transition/transition.tsx +++ b/packages/@headlessui-react/src/components/transition/transition.tsx @@ -292,7 +292,15 @@ function TransitionChildFn(null) - let requiresRef = Boolean(enter || enterFrom || enterTo || leave || leaveFrom || leaveTo) + let requiresRef = Boolean( + enter || + enterFrom || + enterTo || + leave || + leaveFrom || + leaveTo || + (props.as ?? DEFAULT_TRANSITION_CHILD_TAG) !== Fragment + ) let transitionRef = useSyncRefs(...(requiresRef ? [container, ref] : ref === null ? [] : [ref])) let strategy = rest.unmount ?? true ? RenderStrategy.Unmount : RenderStrategy.Hidden @@ -504,7 +512,8 @@ function TransitionRootFn