material icon indicating copy to clipboard operation
material copied to clipboard

Theming is not inherited by dialogs

Open hkgrani opened this issue 11 years ago • 7 comments

Have a look at the plunk : http://plnkr.co/edit/VRvi9JCq7I81QvtTTP94?p=preview

Dialogs will use "default" theme

For custom dialogs you can set theming but it would be nice if it could be inherited by the theme "state" from where the dialog was invoked

hkgrani avatar Feb 05 '15 08:02 hkgrani

That sounds like an intuitive UX.

ThomasBurleson avatar Feb 05 '15 13:02 ThomasBurleson

@rschmukler - has this been fixed already?

ThomasBurleson avatar Feb 14 '15 16:02 ThomasBurleson

@hkgrani the theme is inherited from the parent container that you put the element in. ie. if you specify a parent, the dialog will have the same theme as the parent. I'm not sure if I think that inheriting from the invoking button / event is that intuitive, in that, just because a button has a different theme doesn't mean that a dialog that it spawns should have a context different than the application wide context (default).

I think I'd rather force an explicit configuration than infer something that I'm not sure most developers would expect to happen. I'm open to hearing thoughts to the contrary, if I am the only one that that wouldn't be intuitive to.

rschmukler avatar Feb 17 '15 17:02 rschmukler

@rschmukler my understanding is that for dialogs you do not currently inherit the theme from the parent container. I think the reason for that is that the dialog (.md-dialog-container) are put as a direct child to the body tag and not as a child to the element where it was invoked. My simple plunker example is not a good example of a real use case for this so I will try to describe a better example.

Google documents, Inbox for gmail and Google play store are all examples of complex apps that use colors/theming to help the user understand what part of the application they are in. Building something like this in anguar material you could specify a different theme per main route (green for apps, red for films, blue for books etc). In this scenario (I think) dialog would be the only component that would break the "theme inheritance chain". Themes for custom dialogs could be set "manually" or dynamically if templates are shared across routes. For simple dialogs I see no way to set theme though

Looking at the documentation one more time I see that there is an option to set the parent element. Setting that to something other than document.body may help for theming but I am afraid that would break the backdrop or something similar

Anyways, its not a big problem and I may have misunderstood or are using the components wrongly. If no one else see a use for a "inherit theming" option I am fine with that.

hkgrani avatar Feb 17 '15 23:02 hkgrani

Not sure if it merits a separate issue or not, but theming also is not inherited by mdSelect.

seiyria avatar Feb 27 '15 14:02 seiyria

So we've just "upgraded" from MD 0.8.3 to 0.10.

In 0.8.3, md-dialog had the md-default-theme class applied to it, e.g.: md-dialog.md-default-theme, in what I believe was the CSS styles injected into the <head> by material design.

This created a dialog in our app of: image

In the inspector: image

In 0.10.0, md-dialog.md-default-theme no longer seems to be applied, creating a dialog of: image

In the inspector: image

with the exact same code base (aside from updates to Angular and Material Design libs).

I guess my question is if md-default-theme will no longer by default be applied to md-dialog how exactly can we set a theme on md-dialog?

nkoterba avatar Aug 04 '15 23:08 nkoterba

Can anyone confirm that this is related to #5899?

devversion avatar Feb 19 '16 08:02 devversion