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

fix(dialog): not applying margins to new button variants #11961

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

crisbeto
Copy link
Member

A while ago we introduced a few new button variants, however we never updated the button selector in the dialog which means that they won't get the proper margin if they're placed next to each other. With the new variants, the dialog selector will grow exponentially since we have to list every possible button combination, which is why I added a new class to the button which makes it a lot easier to target any button.

Note: if we consider that this new class won't be very useful and that it's bleeding dialog logic into the button module, I can rework it so it's the dialog that applies a special class to all buttons.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jun 28, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 28, 2018
// Add a class that applies to all buttons. This makes it easier to target if somebody
// wants to target all Material buttons. We do it here rather than `host` to ensure that
// the class is applied to derived classes.
elementRef.nativeElement.classList.add('mat-button-base');
Copy link
Member

Choose a reason for hiding this comment

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

Instead of adding another class of mat-button-base, can we just always have mat-button?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to have a new class, since people could potentially be depending on certain variants not having .mat-button

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

// Add a class that applies to all buttons. This makes it easier to target if somebody
// wants to target all Material buttons. We do it here rather than `host` to ensure that
// the class is applied to derived classes.
elementRef.nativeElement.classList.add('mat-button-base');
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to have a new class, since people could potentially be depending on certain variants not having .mat-button

@ngbot
Copy link

ngbot bot commented Aug 21, 2018

Hi @crisbeto! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@crisbeto crisbeto force-pushed the dialog-button-variants branch from b3d1cee to ace24a8 Compare August 25, 2018 17:19
@jelbourn jelbourn added blocked This issue is blocked by some external factor, such as a prerequisite PR and removed action: merge The PR is ready for merge by the caretaker labels Oct 1, 2018
@jelbourn jelbourn removed blocked This issue is blocked by some external factor, such as a prerequisite PR labels Nov 2, 2018
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Feb 20, 2019
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jul 10, 2019
Reworks the button focus indication and ripples so that they render behind the text of the button, instead of top of it. This helps with the contrast ratios while focused.

Incorporates some of the changes from angular#11961 so that we don't have to increase the size of the CSS selectors.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jul 10, 2019
Reworks the button focus indication and ripples so that they render behind the text of the button, instead of top of it. This helps with the contrast ratios while focused.

Also gets rid of the `mat-button-focus-overlay` element in favor of using `::before` which saves us the extra DOM node.

Incorporates some of the changes from angular#11961 so that we don't have to increase the size of the CSS selectors.
A while ago we introduced a few new button variants, however we never updated the button selector in the dialog which means that they won't get the proper margin if they're placed next to each other. With the new variants, the dialog selector will grow exponentially since we have to list every possible button combination, which is why I added a new class to the button which makes it a lot easier to target any button.
@crisbeto crisbeto force-pushed the dialog-button-variants branch from ace24a8 to fbd4ebc Compare July 10, 2019 20:59
jelbourn pushed a commit that referenced this pull request Jul 12, 2019
Reworks the button focus indication and ripples so that they render behind the text of the button, instead of top of it. This helps with the contrast ratios while focused.

Also gets rid of the `mat-button-focus-overlay` element in favor of using `::before` which saves us the extra DOM node.

Incorporates some of the changes from #11961 so that we don't have to increase the size of the CSS selectors.
jelbourn pushed a commit that referenced this pull request Jul 17, 2019
Reworks the button focus indication and ripples so that they render behind the text of the button, instead of top of it. This helps with the contrast ratios while focused.

Also gets rid of the `mat-button-focus-overlay` element in favor of using `::before` which saves us the extra DOM node.

Incorporates some of the changes from #11961 so that we don't have to increase the size of the CSS selectors.
@crisbeto crisbeto added the P2 The issue is important to a large percentage of users, with a workaround label Aug 14, 2019
@crisbeto
Copy link
Member Author

Setting as a P2, because it keeps coming up in bug reports.

@mmalerba mmalerba merged commit 66fa26f into angular:master Aug 15, 2019
andrewseguin pushed a commit that referenced this pull request Aug 26, 2019
A while ago we introduced a few new button variants, however we never updated the button selector in the dialog which means that they won't get the proper margin if they're placed next to each other. With the new variants, the dialog selector will grow exponentially since we have to list every possible button combination, which is why I added a new class to the button which makes it a lot easier to target any button.

(cherry picked from commit 66fa26f)
@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 Sep 15, 2019
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: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants