-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Dialog] DialogActions
spacing breaks when elements aren't the same type
#36947
Comments
@mikew Thanks for reporting this - we can only use In your case you could manually reapply the spacing using a different selector, example: https://codesandbox.io/s/dialog-actions-spacing-v0iru2?file=/src/App.tsx |
DialogActions
spacing breaks when elements aren't the same typeDialogActions
spacing breaks when elements aren't the same type
dang, I kinda can't wait until we can move past css-in-js 😅 . Thanks for the tip! |
I think we've found a solution mentioned here, so we can close this issue. |
There's no solution, there's a workaround. I propose to at least reopen this issue so the fact it's broken can be tracked. |
I apologize for closing this issue . This is definitely a workaround so I reopened the issue. One approach might involve looping through the children, using React context or other API to find their positions, and applying styling similar to what's being done for ButtonGroup in #38520. But DialogActions may not contain only Material UI Buttons, but other elements as well so this would not be ideal. |
I do think that the solution would work. Basically you only need to add a data attribute to the first element and change the selector to I'm unaware of a solution to cloning/detecting non-rendering elements ( |
To work around this, we just wrapped each element in a |
Is there a reason why |
Because of browser support for flexbox layout's |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/pensive-ride-4ntm36?file=/demo.tsx
Steps:
DialogActions
<Button>
<Button component="a">
Current behavior 😯
Since the CSS selector is
:first-of-type
, if the elements have a different type, spacing between them won't work.Expected behavior 🤔
There would be spacing between the actions in a DialogActions component
Context 🔦
One of our buttons is a "Close" button, the other is a link to download an asset. Since it's a link, it should be an
a
tag, not some random onClick handler.Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: