-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Putting dialog trigger inside dropdown menu adds an extra div #902
Comments
Please provide a reproduction. More infoWhy do I need to provide a reproduction?This project is maintained by a very small team, and we simply don't have the bandwidth to investigate issues that we can't easily replicate. Reproductions enable us to fix issues faster and more efficiently. If you care about getting your issue resolved, providing a reproduction is the best way to do that. I've provided a reproduction - what happens now?Once a reproduction is provided, we'll remove the If How can I create a reproduction?You can use this template to create a minimal reproduction. You can also link to a GitHub repository with the reproduction. Please ensure that the reproduction is as minimal as possible. If there is a ton of custom logic in your reproduction, it is difficult to determine if the issue is with your code or with the library. The more minimal the reproduction, the more likely it is that we'll be able to assist. You might also find these other articles interesting and/or helpful: |
Hi @ChrisPoul I also ran into a problem when calling a Dialog from within a Dropdown menu. It's mentioned a lot on the original Shadcn repo (the ui.shadcn.com) and people suggest different ideas over there that you can probably translate here. This uses the same basic ideas after all. It sounds like your issue may be solved by what I did: open the Dialog programatically using a standard Dropdown.Item element. That way the Dialog is not "in" the Dropdown menu. It's a sibling of it. So it won't add any div etc. which may be breaking your layout. The idea is essentially this (in my case, it's an AlertDialog rather than a Dialog, but the same idea applies).
Notice that rather than have a Dialog with a Trigger component, there is an
Note that since the Dialog is now being opened with an |
Thank you for your help @gregmsanderson, this solved my issue |
Very helpful, @gregmsanderson! I think you could do |
@Stadly No problem. You may well be right about that. |
Describe the bug
I wan't to use a dialog and put it's trigger inside a dropdown menu, the issue I'm having is that it messes up the look since it adds an extra div that wasn't there before.
Here's how it looks when not using the dropdown component:
It behaves as expected with no problem, but when I instead try to use the dropdown menu this happens:
Now there is sudenly an extra div right after the trigger button and this messes up the look of the links.
Here's the code of the dropdown menu:
And this is is the code in the NavLinks component:
It's just a couple of a tags, I need to do it this way because I use those tags somewhere else with a different format.
Reproduction
You can just copy and paste the code I provided in the description
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: