Skip to content

A platform for community discussion. Free, open, simple.

A11Y: Don't show title attr on post avatars (#10719)

Kris614e0bab579c
diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js
index 7b26b162264..d93f410350b 100644
--- a/app/assets/javascripts/discourse/app/widgets/post.js
+++ b/app/assets/javascripts/discourse/app/widgets/post.js
@@ -35,7 +35,12 @@ export function avatarImg(wanted, attrs) {
if (!url || url.length === 0) {
return;
}
- const title = attrs.name || formatUsername(attrs.username);
+
+ let title;
+
+ if (!attrs.hideTitle) {
+ title = attrs.name || formatUsername(attrs.username);
+ }
let className =
"avatar" + (attrs.extraClasses ? " " + attrs.extraClasses : "");
@@ -168,6 +173,7 @@ createWidget("post-avatar", {
name: attrs.name,
url: attrs.usernameUrl,
className: "main-avatar",
+ hideTitle: true,
});
}