Skip to content

fix(material-experimental/mdc-menu): increase specificity of menu pan… #23178

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

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

wagnermaciel
Copy link
Contributor

…el styles

  • We had some order-dependent styles that would be overridden if MDCs styles
    got loaded after ours. We are increasing the specificity of the menu panel
    styles to prevent these styles from being overriden when this edge
    case is hit

@wagnermaciel wagnermaciel requested a review from crisbeto as a code owner July 15, 2021 20:18
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 15, 2021
@wagnermaciel wagnermaciel force-pushed the fix-mdc-menu-positioning branch from e4d1c3a to bc39580 Compare July 15, 2021 20:23

// We need to increase the specificity for these styles to ensure we are not overriden by MDC's
// .mdc-menu-surface styles. This can happen if the MDC styles are loaded in after our styles.
.mat-mdc-menu-panel.mat-mdc-menu-panel {
Copy link
Member

Choose a reason for hiding this comment

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

In what case would MDC's menu styles come in after ours? We should have control over the load order in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have already run into a case internally where this happens, but I'm not sure how they managed to cause it

Copy link
Member

Choose a reason for hiding this comment

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

Is it conflicting with our styles or MDC's? It might be the same issue I was trying to solve with #22562. I think this is fine for now, but we should just understand why it's happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not certain, but if that were the case I should be able to reproduce the issue on our devapp, but I cannot

For context, the app which was able to hit this edge case had a lot of duplicate css (I counted 12 <styles> divs with MDC's menu styles and 6 with our styles). I assumed it was something with the way they were importing styles

@wagnermaciel wagnermaciel force-pushed the fix-mdc-menu-positioning branch from bc39580 to 0fb1126 Compare July 16, 2021 15:38
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM


// We need to increase the specificity for these styles to ensure we are not overriden by MDC's
// .mdc-menu-surface styles. This can happen if the MDC styles are loaded in after our styles.
.mat-mdc-menu-panel.mat-mdc-menu-panel {
Copy link
Member

Choose a reason for hiding this comment

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

Is it conflicting with our styles or MDC's? It might be the same issue I was trying to solve with #22562. I think this is fine for now, but we should just understand why it's happening.

@wagnermaciel wagnermaciel added the target: patch This PR is targeted for the next patch release label Jul 19, 2021
…el styles

* We had some order-dependent styles that would be overridden if MDCs styles
  got loaded after ours. We are increasing the specificity of the menu panel
  styles to prevent these styles from being overriden when this edge
  case is hit
@wagnermaciel wagnermaciel force-pushed the fix-mdc-menu-positioning branch from 0fb1126 to 9b06c80 Compare July 19, 2021 15:50
@wagnermaciel wagnermaciel added the action: merge The PR is ready for merge by the caretaker label Jul 19, 2021
@amysorto amysorto merged commit a81834a into angular:master Jul 20, 2021
amysorto pushed a commit that referenced this pull request Jul 20, 2021
…el styles (#23178)

* We had some order-dependent styles that would be overridden if MDCs styles
  got loaded after ours. We are increasing the specificity of the menu panel
  styles to prevent these styles from being overriden when this edge
  case is hit

(cherry picked from commit a81834a)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants