-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(dialog) md-colors breaking inside of dialogs #11078
fix(dialog) md-colors breaking inside of dialogs #11078
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I hopefully fixed my CLA?! |
I really did it this time! |
CLAs look good, thanks! |
Here is a link to the issue: #10276 Here is a demo of the issue: https://codepen.io/lost_semicolon/pen/appyEG (Taken from the Issue, thanks @mohammadrafigh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution! This looks very good. I just had a few nits, the biggest things that need to be addressed are squashing the commits and more closely following the commit message guidelines.
Please use "Fixes #10276" in the footer and the first line should be "fix(dialog): md-colors breaks inside of dialogs".
src/components/dialog/dialog.spec.js
Outdated
@@ -1774,6 +1774,57 @@ describe('$mdDialog', function() { | |||
}); | |||
|
|||
describe('theming', function () { | |||
|
|||
it('should inherit md-theme if the child has and md-theme to inherit', inject(function ($mdDialog, $mdTheming, $rootScope, $compile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has and md-theme
=> has a md-theme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good now
src/components/dialog/dialog.spec.js
Outdated
|
||
})); | ||
|
||
it('should not set md-theme if the child does not have md-theme to inherit', inject(function ($mdDialog, $mdTheming, $rootScope, $compile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap new lines added in this PR at 120 or less.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good now
src/components/dialog/dialog.spec.js
Outdated
var container = angular.element(parent[0].querySelector('.md-dialog-container')); | ||
|
||
expect(container.attr('md-theme')).toBeUndefined(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good now
src/components/dialog/dialog.spec.js
Outdated
var container = angular.element(parent[0].querySelector('.md-dialog-container')); | ||
|
||
expect(container.attr('md-theme')).toEqual('coolTheme'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good now
Only append an md-theme attribute if the md-dialog is propagated from an element that contains an md-theme. Fixes angular#10276
c32eaf1
to
49593c8
Compare
@Splaktar I believe have addressed all of the changes you requested, let me know if anything else needs tweaking. 🐔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
My first request for this PR to be presubmitted on 3/3 got lost. It will be run through presubmit tomorrow. Sorry for the delay! |
Only append an md-theme attribute if the md-dialog is propagated from an element that contains an md-theme. Fixes angular#10276
Only append an md-theme attribute if the md-dialog is propagated from an element that contains an md-theme. Fixes #10276
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently when you display an mdDialog, the directive tries to see if an md-theme controller exists from where the mdDialog was propogated. The directive then adds an md-theme attrubute to a newly created div inside of md-dialog. The directive does this regardless of whether there is an inherited theme or not.
This is an issue because the md-theme gets set to an empty string and when attempting to use md-colors, it recognizes the empty string as a set theme and incorrectly parses
<div md-colors="{background:'primary'}">
as -primary instead of just primary.
Issue Number: #10276
What is the new behavior?
The md-theme attribute will only be set if a theme actually exists on the element from which
md-dialog is propogated. This allows default themes to work as expected inside of the dialogs.
Does this PR introduce a breaking change?
No breaking changes.
Other information