question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Dialog] Flatten DialogTitle DOM structure

See original GitHub issue

Summary 💡

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Aug 31, 2020

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

  • auto enable disableTypography: avoid useless nested DOM structure
  • have a TypographyProps to spread: allow configuration at the global theme level.
0reactions
vicasascommented, May 24, 2021

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found