material icon indicating copy to clipboard operation
material copied to clipboard

Dialogs are not rendered with the correct theme

Open sdesmond opened this issue 10 years ago • 3 comments

Actual behavior:

  • What is the issue? Dialogs are not respecting the current theme.
  • What is the expected behavior? I would expect dialogs to render according to the current or provided theme.

CodePen or Steps to reproduce the issue: *

  • CodePen Demo which shows your issue : http://codepen.io/anon/pen/gMPxbL?editors=1010
  • Details: Click on "Change Theme" and pop a dialog. They always show in the original default theme. I set .theme('defaultDark') on the confirm dialog and it's half right. The background is fine, but the text color is wrong.

Angular Versions: *

  • Angular Version: 1.5.5
  • Angular Material Version: 1.1.0-rc5

Additional Information:

  • Browser Type: Chrome
  • Browser Version: 51.0.2704.84 m
  • OS: Win
  • Stack Traces: Nope

Shortcut to create a new CodePen Demo. Note: * indicates required information. Without this information, your issue may be auto-closed.

Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.

sdesmond avatar Jun 09 '16 21:06 sdesmond

@sdesmond You are right.

The foreground color is not set on the dialog's content.

Actually, the pre-rendered dialog works pretty well, because it is placed inside of the DOM element, which holds the new theme.

Normally the dialog will use the defaultTheme and you have to specify the theme your self.

But I think it would be good to add a documentation about that and probably add an autodetection, which applies the correct theme from targetEvent property.

Thoughts?

devversion avatar Jun 10 '16 14:06 devversion

Even where I specify a theme for the dialog, it's still not getting the foreground color which is a pretty big deal since it's not actually using the entire theme I specified.

If I had md-theme on my html element, I would expect the entire application to behave as if I had only declared that particular theme. So, for this example I would expect the entire application to use all parts of that dark theme everywhere. Maybe I'm just overestimating the ability of that md-theme attribute.

In my opinion it's a little strange that the dialog always uses the default theme. If, like I mentioned, the dialog is a child of an element with md-theme I would have hoped the dialog would inherit the specified theme.

sdesmond avatar Jun 11 '16 04:06 sdesmond

Thanks @DevVersion.

sdesmond avatar Jun 13 '16 02:06 sdesmond