Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 121e1f3

Browse files
feat(button): Add in HCM support to the mdc button as an opt-in mixin.
PiperOrigin-RevId: 350647182
1 parent 79328c9 commit 121e1f3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

packages/mdc-button/_mixins.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// stylelint-disable selector-class-pattern
2525

2626
@use 'sass:math';
27+
@use '@material/dom/mixins' as dom-mixins;
2728
@use '@material/elevation/mixins' as elevation-mixins;
2829
@use '@material/feature-targeting/feature-targeting';
2930
@use '@material/ripple/ripple';
@@ -425,6 +426,25 @@ $ripple-target: '.mdc-button__ripple';
425426
}
426427
}
427428

429+
///
430+
/// Includes ad-hoc high contrast mode support.
431+
///
432+
@mixin high-contrast-mode-shim($query: feature-targeting.all()) {
433+
&::before {
434+
@include dom-mixins.transparent-border($query: $query);
435+
}
436+
437+
&:focus {
438+
&::before {
439+
@include dom-mixins.transparent-border(
440+
$border-width: 5px,
441+
$border-style: double,
442+
$query: $query
443+
);
444+
}
445+
}
446+
}
447+
428448
@mixin base_($query) {
429449
$feat-color: feature-targeting.create-target($query, color);
430450
$feat-structure: feature-targeting.create-target($query, structure);

packages/mdc-button/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"sideEffects": false,
1717
"dependencies": {
1818
"@material/density": "^9.0.0",
19+
"@material/dom": "^9.0.0",
1920
"@material/elevation": "^9.0.0",
2021
"@material/feature-targeting": "^9.0.0",
2122
"@material/ripple": "^9.0.0",

0 commit comments

Comments
 (0)