-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default tag from div
to Fragment
on Transition
components
#3110
Merged
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
RobinMalfait
force-pushed
the
change/default-transition-tags
branch
from
April 18, 2024 23:30
965a335
to
fa41da9
Compare
If the `<Transition />` component "root" is used as a root placeholder (for state management) and not making actual transitions itself, then we don't require a `ref` element.
+ add `className="…"` to some places to indicate that we _do_ want to perform a transition and thus have to fail if the `ref` is missing.
Also ensure that a ref is required if the `as` prop is provided and it's not a `Fragment`
These tests were rendering a `Debug` element that didn't render any DOM nodes. Adding `as="div"` ensures that we are forwarding the ref correctly.
RobinMalfait
force-pushed
the
change/default-transition-tags
branch
from
April 18, 2024 23:55
fa41da9
to
99698a4
Compare
reinink
changed the title
Change default
Change default tag from Apr 19, 2024
Transition
tag from div
to Fragment
div
to Fragment
on Transition
components
thecrypticace
approved these changes
Apr 19, 2024
reinink
reviewed
Apr 19, 2024
This was referenced May 28, 2024
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.
This PR changes the default tag for the
Transition
,TransitionRoot
, andTransitionChild
components fromdiv
toFragment
.The rational behind this change is that the
Transition
component is a component that "configures" the transition of its children but it was rendering its owndiv
instead. If you want to transition the component you are wrapping, you requiredas={Fragment}
. In practice this tends to be what happens most often.Especially, now in Headless UI v2, a lot of components like
Dialog
,PopoverPanel
,ListboxOptions
,ComboboxOptions
andMenuItems
are portalled to a different place in the DOM. This means that theTransition
is happening on adiv
with no children.Before:
With this change: