UX: add ARIA region role to posts (#13130)

NVDA does not detect HTML5 articles as regions. This explicitly sets a
region with an aria-label denoting post numbers making it much easier to
know where you are in a topic.

Note role: article which is more semantically correct is not respected by
NVDA d/D shortcut, hence the much more generic "region" role.
This commit is contained in:
Sam 2021-05-25 20:58:13 +10:00 committed by GitHub
parent f21d50ebb6
commit 6e2ecf40c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -596,6 +596,10 @@ createWidget("post-article", {
buildAttributes(attrs) {
return {
"aria-label": I18n.t("share.post", {
postNumber: attrs.post_number,
}),
role: "region",
"data-post-id": attrs.id,
"data-topic-id": attrs.topicId,
"data-user-id": attrs.user_id,