Skip to content

Commit aa2dc8e

Browse files
authored
Fix transparent verification checkmark in dark mode (#30235)
* Fix transparent verification checkmark in dark mode Fixes Issue #28285 * Add white background to E2E Warning Icon Also adapted the testcases to the new background.
1 parent 0f7e394 commit aa2dc8e

4 files changed

Lines changed: 33 additions & 4 deletions

File tree

res/css/views/rooms/_E2EIcon.pcss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@ Please see LICENSE files in the repository root for full details.
5959
mask-image: url("$(res)/img/e2e/verified.svg");
6060
background-color: $e2e-verified-color;
6161
}
62+
63+
// When using the "normal" icon as a background for verified or warning icon,
64+
// it should be slightly smaller than the foreground icon
65+
.mx_E2EIcon_verified, .mx_E2EIcon_warning .mx_E2EIcon_normal::after {
66+
mask-size: 90%;
67+
background-color: white;
68+
}

src/components/views/rooms/E2EIcon.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ const E2EIcon: React.FC<Props> = ({
7676
if (onClick) {
7777
content = <AccessibleButton onClick={onClick} className={classes} style={style} />;
7878
} else {
79-
content = <div className={classes} style={style} />;
79+
// Verified and warning icon have a transparent cutout, so add a white background.
80+
// The normal icon already has the correct shape and size, so reuse that.
81+
if (status === E2EStatus.Verified || status === E2EStatus.Warning) {
82+
content = (
83+
<div className={classes} style={style}>
84+
<div className="mx_E2EIcon_normal" />
85+
</div>
86+
);
87+
} else {
88+
content = <div className={classes} style={style} />;
89+
}
8090
}
8191

8292
if (!e2eTitle || hideTooltip) {

test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,11 @@ exports[`RoomView should not display the timeline when the room encryption is lo
18091809
<div
18101810
aria-labelledby="«r3e»"
18111811
class="mx_E2EIcon mx_E2EIcon_verified mx_MessageComposer_e2eIcon"
1812-
/>
1812+
>
1813+
<div
1814+
class="mx_E2EIcon_normal"
1815+
/>
1816+
</div>
18131817
</span>
18141818
</div>
18151819
<div

test/unit-tests/components/views/dialogs/__snapshots__/UntrustedDeviceDialog-test.tsx.snap

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ exports[`<UntrustedDeviceDialog /> should display the dialog for the device of a
2323
<div
2424
class="mx_E2EIcon mx_E2EIcon_warning"
2525
style="width: 24px; height: 24px;"
26-
/>
26+
>
27+
<div
28+
class="mx_E2EIcon_normal"
29+
/>
30+
</div>
2731
Not Trusted
2832
</h1>
2933
</div>
@@ -97,7 +101,11 @@ exports[`<UntrustedDeviceDialog /> should display the dialog for the device of t
97101
<div
98102
class="mx_E2EIcon mx_E2EIcon_warning"
99103
style="width: 24px; height: 24px;"
100-
/>
104+
>
105+
<div
106+
class="mx_E2EIcon_normal"
107+
/>
108+
</div>
101109
Not Trusted
102110
</h1>
103111
</div>

0 commit comments

Comments
 (0)