Skip to content

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

A11Y: make user-info component headings optional (#36209)

Kris8c1371fb2448
diff --git a/frontend/discourse/app/components/directory-item.gjs b/frontend/discourse/app/components/directory-item.gjs
index d52ebb5670c..f343bc70893 100644
--- a/frontend/discourse/app/components/directory-item.gjs
+++ b/frontend/discourse/app/components/directory-item.gjs
@@ -28,7 +28,7 @@ export default class DirectoryItem extends Component {
<template>
<div class="directory-table__cell" role="rowheader">
- <UserInfo @user={{this.item.user}} />
+ <UserInfo @user={{this.item.user}} @headingLevel={{3}} />
</div>
{{#each this.columns as |column|}}
diff --git a/frontend/discourse/app/components/user-info.gjs b/frontend/discourse/app/components/user-info.gjs
index 90eb35e70c5..342bf50c584 100644
--- a/frontend/discourse/app/components/user-info.gjs
+++ b/frontend/discourse/app/components/user-info.gjs
@@ -64,7 +64,8 @@ export default class UserInfo extends Component {
<a
href={{this.userPath}}
data-user-card={{@user.username}}
- role="heading"
+ role={{if @headingLevel "heading"}}
+ aria-level={{@headingLevel}}
>
<span class={{if this.nameFirst "name" "username"}}>
{{if this.nameFirst @user.name (formatUsername @user.username)}}