Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
dialog: theme not inheriting properly when changing themes #11229
Comments
|
Originally I did not realize this, but it appears a work around is setting the targetEvent when opening a dialog via the $mdDialog service. Not sure why/how this is related, and it is not documented anywhere that I've found. |
|
I updated the CodePen to 1.1.8 and I still see the issue. Thank you for reporting this and for creating the CodePen. |
Another workaround – just set the theme explicitly, like so: let alert = $mdDialog.alert({
title: 'Themed',
textContent: 'This dialog is correctly themed!',
ok: 'Close',
theme: $scope.theme
});
$mdDialog.show(alert);
This workaround also works when you can't set |
|
However, while this API is documented, it isn't documented that this API is required for theme inheritance. A note about this needs to be added to the $mdDialog service docs. I don't think that it makes sense directly on the We should also have a brief example of theming dialogs using the |
|
So do I understand correctly that theme inheritance works like theme is inherited from the element which corresponds to the Anyway, information about dialogs' theme inheritance mechanism would be nice in the theming docs as well, as for example for me it was surprising that I set an (The logic of my app is so that it doesn't make sense for my dialogs to have a As I think about it, theme inheritance via |
Yes, see material/src/components/dialog/dialog.js Lines 825 to 839 in a13722e Agreed that it should be mentioned with a note/callout in the theming guide. |


Bug, feature request, or proposal:
Bug
What is the expected behavior?
The dialog will take on the theme that is set on its parent element (or somewhere in the ascendants).
What is the current behavior?
If changing the theme, the dialog still uses the previous theme.
CodePen and steps to reproduce the issue:
CodePen Demo which shows your issue: https://codepen.io/anon/pen/WzmmKx
Detailed Reproduction Steps:
What is the use-case or motivation for changing an existing behavior?
It essentially renders theme changing useless since the interim elements don't respect the change.
Which versions of AngularJS, Material, OS, and browsers are affected?
AngularJS Material >= 1.1.2
AngularJS >= 1.6.0
Is there anything else we should know? Stack Traces, Screenshots, etc.
Likely something in the following changes that broke it: https://github.com/angular/material/pull/9762/files#diff-58cbee594b2fabf2c78b6d283750e535R806