Skip to content

feat(radio/checkbox): show background-color in print stylesheet (#22298) #22299

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 3 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/material-experimental/mdc-checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
}
}


.mdc-checkbox__background {
// force browser to show background-color when using the print function
-webkit-print-color-adjust: exact;
color-adjust: exact;
}

// Angular Material supports disabling all animations when NoopAnimationsModule is imported.
// TODO(mmalerba): Look into using MDC's Sass queries to separate the animation styles and
// conditionally add them. Consider the size cost when deciding whether to switch.
Expand Down
4 changes: 4 additions & 0 deletions src/material/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * checkbox-common.$size !default;
variables.$linear-out-slow-in-timing-function, opacity checkbox-common.$transition-duration
variables.$linear-out-slow-in-timing-function;

// force browser to show background-color when using the print function
-webkit-print-color-adjust: exact;
color-adjust: exact;

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 that we'll need the same fixes for the mdc-radio and mdc-checkbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I open a new pr/issue in the MDC repository or update the material/experimental mdc components in this pull request?

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to fix it on our end for now. If MDC ends up resolving it on their end, we can remove our workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an additional commit for the mdc-checkbox. The mdc-radio was printed fine because it uses a border for the inner circle.

._mat-animation-noopable & {
transition: none;
}
Expand Down
4 changes: 4 additions & 0 deletions src/material/radio/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ $ripple-radius: 20px;
// IE to flash the entire circle for a couple of frames, throwing off the entire animation.
transform: scale(0.001);

// force browser to show background-color when using the print function
-webkit-print-color-adjust: exact;
color-adjust: exact;

._mat-animation-noopable & {
transition: none;
}
Expand Down