A platform for community discussion. Free, open, simple.
A11Y: improve Horizon markup for screenreaders (#40089)
Kris6dd687930ec9
diff --git a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjsindex bb6bf04d34f..573875af248 100644--- a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs+++ b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs@@ -153,7 +153,10 @@ export default class HighContextTopicCard extends Component {</div><div class="hc-topic-card__status-tags">{{#if this.hasSolved}}- <span class="hc-topic-card__status --solved">+ <span+ class="hc-topic-card__status --solved"+ aria-label={{i18n (themePrefix "solved")}}+ >{{#if this.capabilities.viewport.sm}}{{i18n (themePrefix "solved")}}{{/if}}@@ -167,6 +170,7 @@ export default class HighContextTopicCard extends Component {"hc-topic-card__status"this.statusBadge.className}}+ aria-label={{i18n this.statusBadge.text}}>{{dIcon this.statusBadge.icon}}@@ -181,7 +185,7 @@ export default class HighContextTopicCard extends Component {</div><div class="hc-topic-card__content">- <div class="hc-topic-card__title">+ <div class="hc-topic-card__title" role="heading" aria-level="2"><TopicStatus @topic={{@topic}} @context="topic-list" /><TopicLink{{on "focus" this.onTitleFocus}}@@ -223,6 +227,9 @@ export default class HighContextTopicCard extends Component {{{#if this.assignedUser}}<div class="hc-topic-card__assigned">{{dIcon "user-plus"}}+ <span class="sr-only">{{i18n+ "discourse_assign.assigned_to"+ }}</span><spanclass="hc-topic-card__assigned-name">{{this.assignedUser.username}}</span>@@ -231,6 +238,9 @@ export default class HighContextTopicCard extends Component {{{#each this.indirectAssignees as |assignment|}}<div class="hc-topic-card__assigned">{{dIcon "user-plus"}}+ <span class="sr-only">{{i18n+ "discourse_assign.assigned_to"+ }}</span><spanclass="hc-topic-card__assigned-name">{{assignment.user.username}}</span>diff --git a/themes/horizon/javascripts/discourse/components/card/topic-creator-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-creator-column.gjsindex 50b684bbf98..36943d99a4e 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-creator-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-creator-column.gjs@@ -11,7 +11,7 @@ export default class TopicCreatorColumn extends Component {<template><div class={{this.topicCreator.class}}>- {{dAvatar this.topicCreator.user}}+ {{dAvatar this.topicCreator.user imageSize="small"}}</div></template>}diff --git a/themes/horizon/javascripts/discourse/components/card/topic-likes-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-likes-column.gjsindex e4f03f24adc..0093d7cde10 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-likes-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-likes-column.gjs@@ -1,8 +1,13 @@+import { themePrefix } from "virtual:theme";import dIcon from "discourse/ui-kit/helpers/d-icon";+import { i18n } from "discourse-i18n";const TopicLikesColumn = <template>{{#if @topic.like_count}}- <span class="topic-likes">{{dIcon "heart"}}{{@topic.like_count}}</span>+ <span+ class="topic-likes"+ aria-label={{i18n (themePrefix "like_count") [email protected]_count}}+ >{{dIcon "heart"}}{{@topic.like_count}}</span>{{/if}}</template>;diff --git a/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjsindex 4cda9377b7c..06108e8d1ed 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs@@ -1,11 +1,14 @@+import { themePrefix } from "virtual:theme";import dIcon from "discourse/ui-kit/helpers/d-icon";import dNumber from "discourse/ui-kit/helpers/d-number";+import { i18n } from "discourse-i18n";const TopicRepliesColumn = <template>{{#if @topic.replyCount}}- <span class="topic-replies">{{dIcon "reply"}}{{dNumber- @topic.replyCount- }}</span>+ <span+ class="topic-replies"+ aria-label={{i18n (themePrefix "reply_count") [email protected]}}+ >{{dIcon "reply"}}{{dNumber @topic.replyCount}}</span>{{/if}}</template>;