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

Commit 0c87df4

Browse files
authored
Merge pull request #5319 from matrix-org/t3chguy/fix/null-avatar
Fix background-image: url(null) for backdrop filter
2 parents 5c79f35 + 6a82a1f commit 0c87df4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ 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+
if (!avatarUrl) {
125+
document.body.style.removeProperty("--avatar-url");
126+
} else if (document.body.style.getPropertyValue("--avatar-url") !== avatarUrlProp) {
124127
document.body.style.setProperty("--avatar-url", avatarUrlProp);
125128
}
126129
};

0 commit comments

Comments
 (0)