From 6e2ecf40c7456a1af7f6470d09921f0138fbd4bb Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 25 May 2021 20:58:13 +1000 Subject: [PATCH] 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. --- app/assets/javascripts/discourse/app/widgets/post.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js index 9a02a73f2d0..f1afc5f6144 100644 --- a/app/assets/javascripts/discourse/app/widgets/post.js +++ b/app/assets/javascripts/discourse/app/widgets/post.js @@ -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,