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> with <Dialog> breaks clicking the overlay to close #172

Open
RobbieTheWagner opened this issue Dec 14, 2022 · 3 comments · May be fixed by #174
Open

<Transition> with <Dialog> breaks clicking the overlay to close #172

RobbieTheWagner opened this issue Dec 14, 2022 · 3 comments · May be fixed by #174

Comments

@RobbieTheWagner
Copy link

I noticed when perusing the examples today that the animation modal dialog example would not allow me to click outside of it to close the dialog. The non-animated one seems to work fine, and for the animated one if I remove the second <t.Child> it will also work.

I wonder if we need to pass different parents to the transition or something? This is a complex z-index type of issue, since the overlay is nested in one parent and the modal content is nested in another and there is some fixed positioning.

I've been trying to debug this for awhile, but cannot seem to find a workaround. Perhaps we could use something like https://github.com/zeppelin/ember-click-outside and put that modifier on the modal dialog content, instead of handling the click on the overlay?

I'm happy to explore this as a solution if folks think it would be good!

@far-fetched
Copy link
Contributor

Good morning @rwwagner90 👋

Hmm I believe that with <Dialog> component everything is fine. So far, I recognized that one line in the example might be problematic:

https://github.com/GavinJoyce/ember-headlessui/blob/master/test-app/app/templates/dialog/dialog-modal-with-transition.hbs#L42

If you remove these 2 classes (seems that they are redundant) it should work.

PS: AFAIR we already put some effort to remove ember-click-outside, so not sure that folks want to revert it into repo 🤔

@RobbieTheWagner
Copy link
Author

@far-fetched if you remove those classes, won't there be no animations?

@far-fetched
Copy link
Contributor

far-fetched commented Dec 17, 2022

I am not an expert where we should apply transform or transition-all classes. But I found out that even in headless-ui library in examples they applied them in different places:

e.g. into <Transition/> component
Menu component:
2022-12-17_15-23

e.g. into <Dialog/> component
Dialog component:

2022-12-17_15-24

Regarding your question, I believe that animation still works as we apply the same classes a few lines later:
https://github.com/GavinJoyce/ember-headlessui/blob/master/test-app/app/templates/dialog/dialog-modal-with-transition.hbs#L53

@RobbieTheWagner RobbieTheWagner linked a pull request Jan 5, 2023 that will close this issue
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.

2 participants