Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(menu-surface): add feature targeting for styles #4279

Merged

Conversation

crisbeto
Copy link
Collaborator

Sets up style feature targeting for mdc-menu-surface.

Copy link
Collaborator

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may try to take a stab at writing some kind of test or something to detect these nested mdc-feature-target mixins and complain about them, I think this would lead to unexpected results.

@include mdc-feature-targets($feat-structure) {
@include mdc-rtl-reflexive-property(transform-origin, top left, top right);
@include mdc-menu-surface-shape-radius(medium);
@include mdc-menu-surface-base_($query);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move out of this $feat-structure block

}

.mdc-menu-surface--anchor {
@include mdc-feature-targets($feat-structure) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you move this mdc-feature-targets up a level you can surround this rule and the one below

transform: scale(.8);
opacity: 0;

@include mdc-feature-targets($feat-animation) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move out of this $feat-structure block

display: inline-block;
opacity: 0;

@include mdc-feature-targets($feat-animation) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move out of this $feat-structure block

@crisbeto
Copy link
Collaborator Author

For what it's worth, I did try out the nested mdc-feature-target and it seemed to work as expected. That being said, after sleeping on it, it seems like a bad idea, because it means that you can't include the animation styles without including the structure.

@mmalerba
Copy link
Collaborator

Yeah I think it works in certain situations, but not others. If you want to sanity check your PRs, cherry pick in #4281 where I made it an error.

@crisbeto
Copy link
Collaborator Author

I've addressed the feedback @mmalerba.

@mmalerba
Copy link
Collaborator

The CSS diff shows that some rules changed order (possibly ok), but some also gained additional specificity which we probably don't want:

menu-surface-before.css
menu-surface-after.css

packages/mdc-menu-surface/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-menu-surface/_mixins.scss Outdated Show resolved Hide resolved
@crisbeto
Copy link
Collaborator Author

crisbeto commented Jan 25, 2019

@kfranqueiro I've rebased, fixed the redundant selectors and specificity changes.

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks!

}

// postcss-bem-linter: end
}

@mixin mdc-menu-surface-ink-color($color) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the discussion from the switch PR it sounds like we want to add $query support to all of the public mixins, that would mean these 3 too (and make sure to add them to the test file)

@crisbeto
Copy link
Collaborator Author

@mmalerba I've addressed the feedback.

}
}

@include mdc-feature-targets($feat-structure) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invert these to put the feature-targets within each selector. Same for within base_.

@@ -53,4 +54,9 @@
@include mdc-typography-overflow-ellipsis($query: mdc-feature-any());
@include mdc-typography-baseline-top(0, $query: mdc-feature-any());
@include mdc-typography-baseline-bottom(0, $query: mdc-feature-any());

// Menu surface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is missing a call to the baseline mdc-menu-surface mixin. Also can we insert this after menu rather than at the end?

.mdc-menu-surface {
@include mdc-menu-surface-base_($query);
@include mdc-elevation($z-value: 8, $query: $query);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line (fails lint)

@crisbeto
Copy link
Collaborator Author

crisbeto commented Feb 2, 2019

@kfranqueiro the latest set of feedback is addressed.

@kfranqueiro
Copy link
Contributor

Diff looks fine; I ran the mdc-menu screenshot tests and no changes were found. https://storage.googleapis.com/mdc-web-screenshot-tests/kfranqueiro/2019/02/04/15_38_21_044/report/report.html

@kfranqueiro kfranqueiro merged commit 56b8467 into material-components:master Feb 4, 2019
@jamesmfriedman jamesmfriedman mentioned this pull request Feb 5, 2019
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants