A11Y: Make user avatars in posts stream untabbable
The user avatar in posts has aria-hidden set to true to reduce redundancy since the information that the avatar gives to screen readers is the same information that the username/name of the post gives which is the author of the post. However, it's still possible for a screen reader user to reach the avatar by tabbing through the post and when that happens the avatar is read as "blank". This isn't ideal so we should set tabindex to -1 on the avatar to remove it from the default keyboard nav flow.
This commit is contained in:
parent
ca58d80b0c
commit
db67c478be
|
@ -184,14 +184,21 @@ createWidget("post-avatar", {
|
||||||
if (!attrs.user_id) {
|
if (!attrs.user_id) {
|
||||||
body = iconNode("far-trash-alt", { class: "deleted-user-avatar" });
|
body = iconNode("far-trash-alt", { class: "deleted-user-avatar" });
|
||||||
} else {
|
} else {
|
||||||
body = avatarFor.call(this, this.settings.size, {
|
body = avatarFor.call(
|
||||||
template: attrs.avatar_template,
|
this,
|
||||||
username: attrs.username,
|
this.settings.size,
|
||||||
name: attrs.name,
|
{
|
||||||
url: attrs.usernameUrl,
|
template: attrs.avatar_template,
|
||||||
className: `main-avatar ${hideFromAnonUser ? "non-clickable" : ""}`,
|
username: attrs.username,
|
||||||
hideTitle: true,
|
name: attrs.name,
|
||||||
});
|
url: attrs.usernameUrl,
|
||||||
|
className: `main-avatar ${hideFromAnonUser ? "non-clickable" : ""}`,
|
||||||
|
hideTitle: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tabindex: "-1",
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const postAvatarBody = [body];
|
const postAvatarBody = [body];
|
||||||
|
|
Loading…
Reference in New Issue