Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit efad424

Browse files
committed
Fix background-image: url(null) for backdrop filter
Signed-off-by: Michael Telatynski <[email protected]>
1 parent dce047e commit efad424

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

res/themes/light/css/_mods.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
@supports (backdrop-filter: none) {
88
.mx_LeftPanel {
9-
background-image: var(--avatar-url);
9+
background-image: var(--avatar-url, unset);
1010
background-repeat: no-repeat;
1111
background-size: cover;
1212
background-position: left top;

src/components/structures/LeftPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ export default class LeftPanel extends React.Component<IProps, IState> {
119119
if (settingBgMxc) {
120120
avatarUrl = MatrixClientPeg.get().mxcUrlToHttp(settingBgMxc, avatarSize, avatarSize);
121121
}
122+
122123
const avatarUrlProp = `url(${avatarUrl})`;
123-
if (document.body.style.getPropertyValue("--avatar-url") !== avatarUrlProp) {
124+
const existingValue = document.body.style.getPropertyValue("--avatar-url");
125+
if (!avatarUrl && existingValue) {
126+
document.body.style.removeProperty("--avatar-url");
127+
} else if (avatarUrl && existingValue !== avatarUrlProp) {
124128
document.body.style.setProperty("--avatar-url", avatarUrlProp);
125129
}
126130
};

0 commit comments

Comments
 (0)