Skip to content

Commit 53ec44b

Browse files
asyncLizcopybara-github
authored andcommitted
fix(labs): add card support for high contrast mode
PiperOrigin-RevId: 591038474
1 parent 6eb9fe6 commit 53ec44b

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

labs/card/internal/_outlined-card.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
}
3434
}
3535

36-
.container {
37-
border: var(--_outline-width) solid var(--_outline-color);
36+
.outline {
37+
border-color: var(--_outline-color);
38+
border-width: var(--_outline-width);
3839
}
3940
}

labs/card/internal/_shared.scss

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,31 @@
1818
z-index: 0;
1919
}
2020

21-
// Separate element will be needed for disabled opacities (b/307361748)
22-
.container {
23-
background: var(--_container-color);
21+
md-elevation,
22+
.background,
23+
.outline {
2424
border-radius: inherit;
2525
inset: 0;
2626
position: absolute;
27+
}
28+
29+
// Separate element will be needed for disabled opacities (b/307361748)
30+
.background {
31+
background: var(--_container-color);
2732
// Place behind content.
2833
z-index: -1;
2934
}
3035

36+
// Separate element needed to overlay on top of content as opposed to
37+
// background, which is behind content. All cards have an outline for HCM.
38+
.outline {
39+
// A default transparent border that is visible in HCM
40+
border: 1px solid transparent;
41+
// Outline should be placed on top of content, such as images.
42+
z-index: 1;
43+
}
44+
3145
md-elevation {
32-
border-radius: inherit;
3346
// Place behind content.
3447
z-index: -1;
3548

labs/card/internal/card.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ export class Card extends LitElement {
1515
protected override render() {
1616
return html`
1717
<md-elevation part="elevation"></md-elevation>
18-
<div class="container"></div>
18+
<div class="background"></div>
1919
<slot></slot>
20+
<div class="outline"></div>
2021
`;
2122
}
2223
}

0 commit comments

Comments
 (0)