Skip to content

feat(menu): add input to add overlay pane classes #19547

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 2 commits into from
Jun 11, 2020

Conversation

andrewseguin
Copy link
Contributor

Required for GMDC, which needs to automatically add a CSS class to the overlay menu using injected options

@andrewseguin andrewseguin requested review from jelbourn and crisbeto June 5, 2020 16:02
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 5, 2020
@andrewseguin andrewseguin added P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release labels Jun 5, 2020
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.

We have some code on MatMenu that proxies the classes from the mat-menu node to the overlay. Couldn't we take advantage of that?

@andrewseguin
Copy link
Contributor Author

The current panel class input doesn't work because of how we are implementing GMDC. In short, users will import a module GmatMenuModule that import/exports the menu directives. We need to be able to set some custom classname with the module, so this change lets me provide it through the options provider.

@crisbeto
Copy link
Member

crisbeto commented Jun 5, 2020

I see. I think in this case it would make more sense to just use the injection token (as you're doing already) without exposing it as an input. Having it be an input means that we'd also have to ensure that the value on the overlay stays in sync with the input value.

@andrewseguin
Copy link
Contributor Author

andrewseguin commented Jun 5, 2020

I believe they are distinct - the class input currently on the mat-menu will be applied to the element with CSS class mat-menu-panel

The overlayPanelClass will be applied to what the overlay considered its pane, which contains the aforementioned mat-menu-panel.

<div class="cdk-overlay-container">
  <div class="cdk-overlay-connected-position-bounding-box">
    <div class="cdk-overlay-pane"> <-- new input
      <div class="mat-menu-panel"> <-- existing input

I considered making the injected option affect the existing input but I didn't want to have to deal with figuring out how to make sure we merge the options and input together.

@crisbeto
Copy link
Member

crisbeto commented Jun 5, 2020

Sorry, what I meant is that we should do what you're currently doing, but we shouldn't add a new input. IMO the only place the panelClass would be configured would be the injection token.

@andrewseguin andrewseguin force-pushed the menu-overlay-class branch 2 times, most recently from 970c522 to bfc0f6c Compare June 5, 2020 18:29
@andrewseguin
Copy link
Contributor Author

Probably would make sense to incrementally add anyways. This is a very niche edge case and would be confusing trying to explain the different between the inputs to users. I removed the input and kept the rest

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

@crisbeto crisbeto added the lgtm label Jun 5, 2020
@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Jun 5, 2020
@andrewseguin andrewseguin merged commit 5244a9f into angular:master Jun 11, 2020
@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 Jul 12, 2020
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 P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants