Merge pull request #5319 from matrix-org/t3chguy/fix/null-avatar
Fix background-image: url(null) for backdrop filterpull/21833/head
commit
0c87df4957
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
@supports (backdrop-filter: none) {
|
@supports (backdrop-filter: none) {
|
||||||
.mx_LeftPanel {
|
.mx_LeftPanel {
|
||||||
background-image: var(--avatar-url);
|
background-image: var(--avatar-url, unset);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: left top;
|
background-position: left top;
|
||||||
|
|
|
@ -119,8 +119,11 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
if (settingBgMxc) {
|
if (settingBgMxc) {
|
||||||
avatarUrl = MatrixClientPeg.get().mxcUrlToHttp(settingBgMxc, avatarSize, avatarSize);
|
avatarUrl = MatrixClientPeg.get().mxcUrlToHttp(settingBgMxc, avatarSize, avatarSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
const avatarUrlProp = `url(${avatarUrl})`;
|
const avatarUrlProp = `url(${avatarUrl})`;
|
||||||
if (document.body.style.getPropertyValue("--avatar-url") !== avatarUrlProp) {
|
if (!avatarUrl) {
|
||||||
|
document.body.style.removeProperty("--avatar-url");
|
||||||
|
} else if (document.body.style.getPropertyValue("--avatar-url") !== avatarUrlProp) {
|
||||||
document.body.style.setProperty("--avatar-url", avatarUrlProp);
|
document.body.style.setProperty("--avatar-url", avatarUrlProp);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue