Skip to content
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

Transition does not respect responsive display styles from the parent element #3328

Closed
anniegiang-octave opened this issue Jun 25, 2024 · 3 comments · Fixed by #3372
Closed
Assignees

Comments

@anniegiang-octave
Copy link

anniegiang-octave commented Jun 25, 2024

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

2.0.4

What browser are you using?
Chrome Version 126.0.6478.114 (Official Build) (arm64)

Reproduction URL
https://kw6kvd-3000.csb.app/

Sandbox

Describe your issue

  1. Open the reproduction URL above. You should see two texts that have colored backgrounds. Only the red one is rendered inside of a Transition.
  2. In Chrome, open the inspector and toggle the device toolbar. Set the dimensions to be responsive.
  3. Decrease the screen width until you know longer see both texts.
  4. Increase the screen width until you see the yellow one.

Expected behavior:
In step 4, the red one should also appear at breakpoints greater than md as specified in the parent div but it doesn't appear.

It's worth noting that this issue does not happen with the React + Tailwind boilerplate sandbox and versions for the following packages:

"@headlessui/react": "2.0.4",
"react": "18.3.1",
"react-dom": "18.3.1"

https://n5lf4f-5173.csb.app/

Sandbox

@thecrypticace
Copy link
Contributor

I get a "Devbox not found" error and "Unauthorized Preview" from your reproduction(s). Any chance you could update them?

@anniegiang-octave
Copy link
Author

anniegiang-octave commented Jun 25, 2024

I get a "Devbox not found" error and "Unauthorized Preview" from your reproduction(s). Any chance you could update them?

@thecrypticace updated the sandbox links

@RobinMalfait RobinMalfait self-assigned this Jul 8, 2024
RobinMalfait added a commit that referenced this issue Jul 8, 2024
This was originally introduced in
#1519 to fix an issue
where some enter transitions where broken: #1503

However, since we refactored the `Transition` component to make use of
the `useTransition` hook, I can't seem to reproduce this issue anymore.

In fact, removing this code fixes an issue.

The bigger issue here is that when the component becomes hidden, that we
always set the state to hidden as well. But if it becomes visible again,
we don't show it again.

Right now, since I couldn't reproduce any of the other issue, I opted to
just removing the code entirely. But if we ever need it again, we
probably have to make sure that it becomes visible in the other scenario
as well.

Fixes: #3328
RobinMalfait added a commit that referenced this issue Jul 10, 2024
…dden (#3372)

* do not change visibility of `Transition` component

This was originally introduced in
#1519 to fix an issue
where some enter transitions where broken: #1503

However, since we refactored the `Transition` component to make use of
the `useTransition` hook, I can't seem to reproduce this issue anymore.

In fact, removing this code fixes an issue.

The bigger issue here is that when the component becomes hidden, that we
always set the state to hidden as well. But if it becomes visible again,
we don't show it again.

Right now, since I couldn't reproduce any of the other issue, I opted to
just removing the code entirely. But if we ever need it again, we
probably have to make sure that it becomes visible in the other scenario
as well.

Fixes: #3328

* update changelog
@RobinMalfait
Copy link
Member

This should be fixed by #3372, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants