Skip to content

Commit

Permalink
A11Y: Adjust heading rules on topic lists (discourse#13353)
Browse files Browse the repository at this point in the history
Previously due to "rowheader" role we would read out topic titles twice.

This adjusts it so we apply the heading role only to the topic link.
In turn this makes navigation through topic lists more accurate (h) only
lands you on topic links. It also reduces the amount of duplicate reading
NVDA does.

Before:

Topic title link new topic link support link b481 link 19h link 2 button...

After:

Topic title link


This reduces noise, up and down once you land on a topic link can give you
more context.
  • Loading branch information
SamSaffron authored Jun 10, 2021
1 parent 6f76479 commit 3fefdb1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export default Component.extend({
classNameBindings: [":topic-list-item", "unboundClassNames", "topic.visited"],
attributeBindings: ["data-topic-id", "role", "ariaLevel:aria-level"],
"data-topic-id": alias("topic.id"),
role: "heading",
ariaLevel: "2",

didReceiveAttrs() {
this._super(...arguments);
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/discourse/app/helpers/topic-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ registerUnbound("topic-link", (topic, args) => {

return htmlSafe(
`<a href='${url}'
role='heading'
level='2'
class='${classes.join(" ")}'
data-topic-id='${topic.id}'>${title}</a>`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
This causes the topic-post-badge to be considered the same word as "text"
at the end of the link, preventing it from line wrapping onto its own line.
--}}
<td class='main-link clearfix' colspan="1" role="rowheader">
<td class='main-link clearfix' colspan="1">
{{~raw-plugin-outlet name="topic-list-before-link"}}
<span class='link-top-line'>
{{~raw-plugin-outlet name="topic-list-before-status"}}
Expand Down

0 comments on commit 3fefdb1

Please sign in to comment.