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 Neil Lalonde
parent 8e0a669aa5
commit 873eb405cd
No known key found for this signature in database
GPG Key ID: FF871CA9037D0A91

View File

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