about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/avatar.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-28 00:48:45 +0200
committerGitHub <noreply@github.com>2022-10-28 00:48:45 +0200
commit8dfe5179ee7186e549dbe1186a151ffa848fe8ab (patch)
tree9b2ec70b5330372ea02e8d14e5f9dc3f402ea2d9 /app/javascript/mastodon/components/avatar.js
parent07cc201accd4a04c8c11cda21eecded4e7875d55 (diff)
Fix avatars not using image tags in web UI (#19488)
Fix #19483
Diffstat (limited to 'app/javascript/mastodon/components/avatar.js')
-rw-r--r--app/javascript/mastodon/components/avatar.js26
1 files changed, 8 insertions, 18 deletions
diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/mastodon/components/avatar.js
index dd3932ae6..207b26691 100644
--- a/app/javascript/mastodon/components/avatar.js
+++ b/app/javascript/mastodon/components/avatar.js
@@ -42,30 +42,20 @@ export default class Avatar extends React.PureComponent {
       ...this.props.style,
       width: `${size}px`,
       height: `${size}px`,
-      backgroundSize: `${size}px ${size}px`,
     };
 
-    if (account) {
-      const src = account.get('avatar');
-      const staticSrc = account.get('avatar_static');
+    let src;
 
-      if (hovering || animate) {
-        style.backgroundImage = `url(${src})`;
-      } else {
-        style.backgroundImage = `url(${staticSrc})`;
-      }
+    if (hovering || animate) {
+      src = account?.get('avatar');
+    } else {
+      src = account?.get('avatar_static');
     }
 
-
     return (
-      <div
-        className={classNames('account__avatar', { 'account__avatar-inline': inline })}
-        onMouseEnter={this.handleMouseEnter}
-        onMouseLeave={this.handleMouseLeave}
-        style={style}
-        role='img'
-        aria-label={account?.get('acct')}
-      />
+      <div className={classNames('account__avatar', { 'account__avatar-inline': inline })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} style={style}>
+        <img src={src} alt={account?.get('acct')} />
+      </div>
     );
   }