Skip to content

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

A11Y: make ariaLabelledBy conditional for topic lists (#35334)

Krisbf53b4e8ff37
diff --git a/app/assets/javascripts/discourse/app/components/discovery/topics.gjs b/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
index f647d6e2417..84d7e137d5b 100644
--- a/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
+++ b/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
@@ -309,6 +309,7 @@ export default class DiscoveryTopics extends Component {
{{#if this.hasTopics}}
<List
+ @ariaLabelledby="topic-list-heading"
@highlightLastVisited={{true}}
@top={{this.top}}
@hot={{this.hot}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs
index c021a5a5e2f..dbc653fb052 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs
@@ -189,7 +189,7 @@ export default class TopicList extends Component {
(if this.bulkSelectEnabled "sticky-header bulk-select-enabled")
this.additionalClasses
}}
- aria-labelledby="topic-list-heading"
+ aria-labelledby={{@ariaLabelledby}}
...attributes
>
<caption class="sr-only">{{i18n "sr_topic_list_caption"}}</caption>