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

mat-button-toggle styling issues #14721

Closed
fad250 opened this issue Jan 4, 2019 · 6 comments · Fixed by #14722
Closed

mat-button-toggle styling issues #14721

fad250 opened this issue Jan 4, 2019 · 6 comments · Fixed by #14722
Assignees
Labels
area: material/button-toggle P4 A relatively minor issue that is not relevant to core functions

Comments

@fad250
Copy link

fad250 commented Jan 4, 2019

Bug 1:

Issue

Applying custom style for checked button toggle gives an odd hover effect.

eg.

.mat-button-toggle-checked{
  background-color: #2979FF;
  color: white;
} 

button-toggle-bug

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ivjb9g

Bug 2:

Issue

In legacy style, button elevation cannot be modified.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ivjb9g-tdqden

@crisbeto crisbeto self-assigned this Jan 4, 2019
@crisbeto crisbeto added has pr P4 A relatively minor issue that is not relevant to core functions labels Jan 4, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2019
…yling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
@wottpal
Copy link

wottpal commented Mar 24, 2019

Does anybody know a temporary fix? :)

crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 27, 2019
…yling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2020
…yling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 2, 2020
…yling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
@skobak
Copy link

skobak commented Jul 2, 2020

Does anybody know a temporary fix? :)

A bit ugly hack, but works

::ng-deep .mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay {
    opacity: 0 !important;
}

@blogcraft
Copy link

I find mat-button-toggle the worst component of Angular Material.

@tawani
Copy link

tawani commented Apr 3, 2021

I find mat-button-toggle the worst component of Angular Material.

It is as if they literally wanted to make it horrible.

crisbeto added a commit to crisbeto/material2 that referenced this issue May 7, 2021
…ntrast styling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
crisbeto added a commit to crisbeto/material2 that referenced this issue May 7, 2021
…ntrast styling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
@zzeneg
Copy link

zzeneg commented Sep 21, 2021

For bug 1:
The problem is in color: white, you have to set it on .mat-button-toggle-checked button to avoid it. Unfortunately it works only with ::ng-deep. https://stackblitz.com/edit/angular-ivjb9g-sse7ch
On the other hand such overrides should be a part of your custom material theme, so just put it in your theme.scss:

.mat-button-toggle {
    button {
        color: mat-color($color-primary);
    }
}
.mat-button-toggle-checked {
    background-color: mat-color($color-primary);

    button {
        color: #fff;
    }
}

andrewseguin pushed a commit that referenced this issue Feb 20, 2022
…ntrast styling applied incorrectly (#14722)

* Fixes not being able to override the elevation of a button toggle. Similar to #7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes #14721.

(cherry picked from commit b703cb3)
andrewseguin pushed a commit that referenced this issue Feb 20, 2022
…ntrast styling applied incorrectly (#14722)

* Fixes not being able to override the elevation of a button toggle. Similar to #7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes #14721.
@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 Mar 23, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…ntrast styling applied incorrectly (angular#14722)

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/button-toggle P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
8 participants