mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
A11Y: Don't output aria-labelledby
when card is empty (#22247)
The user card is always present in the DOM. Therefore we only need to add the `aria-labelledby` attribute when there is a user (and a title) to point to.
This commit is contained in:
parent
4e5575c065
commit
a984a807fd
@ -9,7 +9,6 @@
|
||||
@composePrivateMessage={{route-action "composePrivateMessage"}}
|
||||
@createNewMessageViaParams={{route-action "createNewMessageViaParams"}}
|
||||
role="dialog"
|
||||
aria-labelledby="discourse-user-card-title"
|
||||
/>
|
||||
|
||||
<GroupCardContents
|
||||
|
@ -30,6 +30,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
||||
"usernameClass",
|
||||
"primaryGroup",
|
||||
],
|
||||
attributeBindings: ["labelledBy:aria-labelledby"],
|
||||
allowBackgrounds: setting("allow_profile_backgrounds"),
|
||||
showBadges: setting("enable_badges"),
|
||||
|
||||
@ -46,6 +47,11 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
||||
showDelete: and("viewingAdmin", "showName", "user.canBeDeleted"),
|
||||
linkWebsite: not("user.isBasic"),
|
||||
|
||||
@discourseComputed("user")
|
||||
labelledBy(user) {
|
||||
return user ? "discourse-user-card-title" : null;
|
||||
},
|
||||
|
||||
@discourseComputed("user")
|
||||
hasLocaleOrWebsite(user) {
|
||||
return user.location || user.website_name || this.userTimezone;
|
||||
|
Loading…
x
Reference in New Issue
Block a user