Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit ef24ea0

Browse files
zacharydentonnshahan
authored andcommitted
Update material-yes-no-buttons mixins to use CSS shimming.
Unfortunately, despite the warning at the top of the file, unique selectors were not used (witness selectors such as '', '.buttons', or '.yes-no-buttons'), causing mixins to override other mixins in other parts of the app or even in other apps entirely. This is especially problematic when a mixin overrides the button text color to be the same as the background color, effectively making the button invisible. PiperOrigin-RevId: 173286018
1 parent d6ba415 commit ef24ea0

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

lib/material_yes_no_buttons/_mixins.scss

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,39 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// Change the color of the yes no buttons.
6-
/// WARNING: be sure to pick a unique selector for the selector argument, as
7-
/// this will be applied to all material-yes-no-buttons that match the given
8-
/// selector.
9-
10-
/// Change the color of the yes button
11-
@mixin material-yes-button-color($selector, $value) {
12-
::ng-deep material-yes-no-buttons#{$selector} .btn-yes[raised],
13-
::ng-deep material-yes-no-buttons#{$selector} .btn-yes.btn:not([disabled]).highlighted[raised] {
5+
// Change the color of the yes button.
6+
//
7+
// Apply directly to the <material-yes-no-buttons> element.
8+
@mixin material-yes-button-color($value) {
9+
::ng-deep .btn-yes[raised],
10+
::ng-deep .btn-yes.btn:not([disabled]).highlighted[raised] {
1411
background-color: $value;
1512
}
1613
}
1714

18-
/// Change the color of text in the yes button
19-
@mixin material-yes-button-text-color($selector, $value) {
20-
::ng-deep material-yes-no-buttons#{$selector} .btn-yes {
15+
// Change the color of text in the yes button.
16+
//
17+
// Apply directly to the <material-yes-no-buttons> element.
18+
@mixin material-yes-button-text-color($value) {
19+
::ng-deep .btn-yes {
2120
color: $value;
2221
}
2322
}
2423

25-
/// Change the color of the no button
26-
@mixin material-no-button-color($selector, $value) {
27-
::ng-deep material-yes-no-buttons#{$selector} .btn-no[raised] {
24+
// Change the color of the no button.
25+
//
26+
// Apply directly to the <material-yes-no-buttons> element.
27+
@mixin material-no-button-color($value) {
28+
::ng-deep .btn-no[raised] {
2829
background-color: $value;
2930
}
3031
}
3132

32-
/// Change the color of text in the no button
33-
@mixin material-no-button-text-color($selector, $value) {
34-
::ng-deep material-yes-no-buttons#{$selector} .btn-no {
33+
// Change the color of text in the no button.
34+
//
35+
// Apply directly to the <material-yes-no-buttons> element.
36+
@mixin material-no-button-text-color($value) {
37+
::ng-deep .btn-no {
3538
color: $value;
3639
}
3740
}

0 commit comments

Comments
 (0)