[Dialog] Flatten DialogTitle DOM structure
See original GitHub issueSummary 💡
DialogTitle
should be flatter
Examples 🌈
Motivation 🔦
- Aligning items of the title
<DialogTitle style={ display: 'flex', alignItems: 'center' }> <SomeIcon /> My Title </DialogTitle>
- fewer DOM elements -> fewer brittle element selectors
It is possible but requires targetting nested elements. disableTypography
is not helpful since then we wouldn’t render a heading element.
We could leverage aria but this would go against rule 1 of aria (don’t use aria): <DialogTitle disableTypography role="heading" aria-level="2" className={variantH2Styles} />
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
[Dialog] Flatten DialogTitle DOM structure #19696 - GitHub
It is possible but requires targetting nested elements. disableTypography is not helpful since then we wouldn't render a heading element. We ...
Read more >Breaking changes in v5, part two: core components - Material UI
renderOption should now return the full DOM structure of the option. ... Flatten DialogTitle DOM structure and remove the disableTypography prop.
Read more >Encapsulating Style and Structure with Shadow DOM
Adding the shadow DOM to our dialog ... style a <strong> element inside a <p> element within the flattened DOM tree in our...
Read more >Click handler on jQuery Dialog header/title - Stack Overflow
I found the solution.. the ui.dialog-titlebar class is not child of the dialog reference. So I simply did dlg.parent().find('.ui-dialog-titlebar').click(.
Read more >@rmwc/dialog | Yarn - Package Manager
Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We recently had a tweet on this matter: https://twitter.com/optimistavf/status/1300343255968747521. If we don’t move in the direction proposed in the issue’s description, I think that we should apply the List’s tradeoff:
https://github.com/mui-org/material-ui/blob/02b722a249d1afe001e01827f6197c4b223ea0ce/packages/material-ui/src/ListItemText/ListItemText.js#L49
TypographyProps
to spread: allow configuration at the global theme level.With option 3, if you want to do something custom, should you stop using
DialogTitle
? If not used, the root element styles would be lost and it would be left to the developer to add minimal styles (example padding)