From e8119119d6e45fad60c44e093db30ddd911d2fe8 Mon Sep 17 00:00:00 2001 From: arbirali Date: Mon, 12 May 2025 19:24:00 +0500 Subject: [PATCH 1/3] fix: wrap meaningful icons with text to improve screen reader output --- src/assets/Empty.jsx | 2 +- src/discussions/common/HoverCard.jsx | 28 +++++++++++-------- .../posts/post-editor/PostEditor.jsx | 4 +-- .../posts/post-editor/PostTypeCard.jsx | 2 +- src/discussions/posts/post/LikeButton.jsx | 19 +++++++------ src/discussions/posts/post/PostFooter.jsx | 27 ++++++++++-------- .../posts/post/PostSummaryFooter.jsx | 21 ++++++++------ 7 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/assets/Empty.jsx b/src/assets/Empty.jsx index f9432b8fe..c6e244b9e 100644 --- a/src/assets/Empty.jsx +++ b/src/assets/Empty.jsx @@ -1,5 +1,5 @@ const Empty = () => ( - +
+ { + const actionFunction = actionHandlers[endorseIcons.action]; + actionFunction(); + }} + className={['endorse', 'unendorse'].includes(endorseIcons.id) ? 'text-dark-500' : 'text-success-500'} + size="sm" + alt="Endorse" + /> + {intl.formatMessage(endorseIcons.label)} +
)} @@ -94,6 +98,7 @@ const HoverCard = ({ onLike(); }} /> + {intl.formatMessage(messages.like)} {following !== undefined && (
@@ -108,6 +113,7 @@ const HoverCard = ({ onFollow(); }} /> + {intl.formatMessage(messages.follow)}
)}
diff --git a/src/discussions/posts/post-editor/PostEditor.jsx b/src/discussions/posts/post-editor/PostEditor.jsx index a2f57959c..a58569cd9 100644 --- a/src/discussions/posts/post-editor/PostEditor.jsx +++ b/src/discussions/posts/post-editor/PostEditor.jsx @@ -259,13 +259,13 @@ const PostEditor = ({ value="discussion" selected={values.postType === 'discussion'} type={intl.formatMessage(messages.discussionType)} - icon={} + icon={} /> } + icon={} />
diff --git a/src/discussions/posts/post-editor/PostTypeCard.jsx b/src/discussions/posts/post-editor/PostTypeCard.jsx index b735e7b6f..f712e8ebe 100644 --- a/src/discussions/posts/post-editor/PostTypeCard.jsx +++ b/src/discussions/posts/post-editor/PostTypeCard.jsx @@ -26,7 +26,7 @@ const PostTypeCard = ({ > {icon} - {type} + {type} diff --git a/src/discussions/posts/post/LikeButton.jsx b/src/discussions/posts/post/LikeButton.jsx index f54d01e76..b64652336 100644 --- a/src/discussions/posts/post/LikeButton.jsx +++ b/src/discussions/posts/post/LikeButton.jsx @@ -29,14 +29,17 @@ const LikeButton = ({ count, onClick, voted }) => { )} > - +
+ + {intl.formatMessage(messages.like)} +
{(count && count > 0) ? count : null} diff --git a/src/discussions/posts/post/PostFooter.jsx b/src/discussions/posts/post/PostFooter.jsx index e61377bd0..28d1da7a1 100644 --- a/src/discussions/posts/post/PostFooter.jsx +++ b/src/discussions/posts/post/PostFooter.jsx @@ -49,18 +49,21 @@ const PostFooter = ({ )} > - { - e.preventDefault(); - dispatch(updateExistingThread(id, { following: !following })); - return true; - }} - iconAs={Icon} - iconClassNames="follow-icon-dimensions" - className="post-footer-icon-dimensions" - alt="Follow" - /> +
+ { + e.preventDefault(); + dispatch(updateExistingThread(id, { following: !following })); + return true; + }} + iconAs={Icon} + iconClassNames="follow-icon-dimensions" + className="post-footer-icon-dimensions" + alt="Follow" + /> + {intl.formatMessage(following ? messages.unFollow : messages.follow)} +
)}
diff --git a/src/discussions/posts/post/PostSummaryFooter.jsx b/src/discussions/posts/post/PostSummaryFooter.jsx index b41be165f..395fb9ad7 100644 --- a/src/discussions/posts/post/PostSummaryFooter.jsx +++ b/src/discussions/posts/post/PostSummaryFooter.jsx @@ -44,9 +44,10 @@ const PostSummaryFooter = ({ )} > - +
+ {' '}{intl.formatMessage(voted ? messages.likedPost : messages.postLikes)} - +
{(voteCount && voteCount > 0) ? voteCount : null} @@ -60,11 +61,12 @@ const PostSummaryFooter = ({ )} > - +
+ {' '}{intl.formatMessage(following ? messages.srOnlyFollowDescription : messages.srOnlyUnFollowDescription)} - +
{preview && commentCount > 1 && ( @@ -76,12 +78,13 @@ const PostSummaryFooter = ({ )} > - +
+ {' '} {intl.formatMessage(messages.activity)} - +
{commentCount}
From 9e0c0a7b2e6f4c861ba134fc290c9f9f8b85a598 Mon Sep 17 00:00:00 2001 From: arbirali Date: Mon, 12 May 2025 21:04:18 +0500 Subject: [PATCH 2/3] fix: wrap meaningful icons with text to improve screen reader output --- src/components/TopicStats.jsx | 14 ++++++++++++++ src/discussions/learners/learner/LearnerFooter.jsx | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/components/TopicStats.jsx b/src/components/TopicStats.jsx index 23cc02ee8..7afa5e009 100644 --- a/src/components/TopicStats.jsx +++ b/src/components/TopicStats.jsx @@ -41,6 +41,11 @@ const TopicStats = ({ >
+ + {intl.formatMessage(messages.discussions, { + count: threadCounts?.discussion || 0, + })} + {threadCounts?.discussion || 0}
@@ -59,6 +64,11 @@ const TopicStats = ({ >
+ + {intl.formatMessage(messages.questions, { + count: threadCounts?.question || 0, + })} + {threadCounts?.question || 0}
@@ -85,6 +95,10 @@ const TopicStats = ({ >
+ + {intl.formatMessage(inactiveFlags ? messages.previouslyReported : messages.reported)} + + {activeFlags}{Boolean(inactiveFlags) && `/${inactiveFlags}`}
diff --git a/src/discussions/learners/learner/LearnerFooter.jsx b/src/discussions/learners/learner/LearnerFooter.jsx index ce4adc9e0..653f973b4 100644 --- a/src/discussions/learners/learner/LearnerFooter.jsx +++ b/src/discussions/learners/learner/LearnerFooter.jsx @@ -35,6 +35,7 @@ const LearnerFooter = ({ >
+ {intl.formatMessage(messages.allActivity)} {threads + responses + replies}
@@ -51,6 +52,7 @@ const LearnerFooter = ({ >
+ {intl.formatMessage(messages.posts)} {threads}
From 10543dca31e0fb7c8efe0d441b75d35f9e127b35 Mon Sep 17 00:00:00 2001 From: arbirali Date: Tue, 20 May 2025 19:36:00 +0500 Subject: [PATCH 3/3] fix: duplicate labels on post type selection --- src/discussions/posts/post-editor/PostTypeCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/discussions/posts/post-editor/PostTypeCard.jsx b/src/discussions/posts/post-editor/PostTypeCard.jsx index f712e8ebe..b7afd6328 100644 --- a/src/discussions/posts/post-editor/PostTypeCard.jsx +++ b/src/discussions/posts/post-editor/PostTypeCard.jsx @@ -15,7 +15,7 @@ const PostTypeCard = ({ const { enableInContextSidebar } = useContext(DiscussionContext); // Need to use regular label since Form.Label doesn't support overriding htmlFor return ( -