From 21d25b1bbe626e7cc904918a9a25e8ee8922c638 Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Thu, 13 Mar 2025 23:27:20 +0500 Subject: [PATCH 1/3] made icons inside topic module tab accessible --- src/components/TopicStats.jsx | 4 +-- .../in-context-topics/topic/Topic.jsx | 26 +++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/TopicStats.jsx b/src/components/TopicStats.jsx index 23cc02ee8..b3d3f0bc4 100644 --- a/src/components/TopicStats.jsx +++ b/src/components/TopicStats.jsx @@ -39,7 +39,7 @@ const TopicStats = ({ )} > -
+
{threadCounts?.discussion || 0}
@@ -57,7 +57,7 @@ const TopicStats = ({ )} > -
+
{threadCounts?.question || 0}
diff --git a/src/discussions/in-context-topics/topic/Topic.jsx b/src/discussions/in-context-topics/topic/Topic.jsx index fb3d0caf9..6ba715c72 100644 --- a/src/discussions/in-context-topics/topic/Topic.jsx +++ b/src/discussions/in-context-topics/topic/Topic.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { Link, useParams } from 'react-router-dom'; +import { useParams } from 'react-router-dom'; import { useIntl } from '@edx/frontend-platform/i18n'; @@ -10,6 +10,7 @@ import TopicStats from '../../../components/TopicStats'; import { Routes } from '../../../data/constants'; import { discussionsPath } from '../../utils'; import messages from '../messages'; +import { useNavigate } from 'react-router-dom'; const Topic = ({ topic, @@ -18,6 +19,7 @@ const Topic = ({ }) => { const intl = useIntl(); const { courseId } = useParams(); + const navigate = useNavigate(); const isSelected = (id) => window.location.pathname.includes(id); const topicUrl = discussionsPath(Routes.TOPICS.TOPIC, { courseId, @@ -26,16 +28,24 @@ const Topic = ({ return ( <> - isSelected(topic.id)} + onClick={() => { + isSelected(topic.id); + navigate(topicUrl()); + }} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + isSelected(topic.id); + navigate(topicUrl()); + } + }} aria-current={isSelected(topic.id) ? 'page' : undefined} role="option" tabIndex={(isSelected(topic.id) || index === 0) ? 0 : -1} + style={{ cursor: 'pointer' }} >
@@ -47,7 +57,7 @@ const Topic = ({
- +
{!showDivider && ( <>
From 1bbb18df111455d8c91649e5e73f9da4c77c0462 Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Thu, 15 May 2025 19:39:40 +0500 Subject: [PATCH 2/3] fix: updated main content block id to make skip to content work correctly --- src/discussions/discussions-home/DiscussionsHome.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/discussions/discussions-home/DiscussionsHome.jsx b/src/discussions/discussions-home/DiscussionsHome.jsx index c46247ddc..413b1405d 100644 --- a/src/discussions/discussions-home/DiscussionsHome.jsx +++ b/src/discussions/discussions-home/DiscussionsHome.jsx @@ -82,7 +82,7 @@ const DiscussionsHome = () => { )}> {!enableInContextSidebar && (
)} -
+
{!enableInContextSidebar && } {(isEnrolled || !isUserLearner) && (
Date: Wed, 21 May 2025 23:06:15 +0500 Subject: [PATCH 3/3] fix: lint error fixed --- src/components/TinyMCEEditor.jsx | 1 + src/discussions/in-context-topics/topic/Topic.jsx | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/TinyMCEEditor.jsx b/src/components/TinyMCEEditor.jsx index 510adf17e..cde183286 100644 --- a/src/components/TinyMCEEditor.jsx +++ b/src/components/TinyMCEEditor.jsx @@ -152,6 +152,7 @@ const TinyMCEEditor = (props) => { relative_urls: false, default_link_target: '_blank', target_list: false, + placeholder: props.placeholder, images_upload_handler: uploadHandler, setup, }} diff --git a/src/discussions/in-context-topics/topic/Topic.jsx b/src/discussions/in-context-topics/topic/Topic.jsx index 6ba715c72..f5e074bb4 100644 --- a/src/discussions/in-context-topics/topic/Topic.jsx +++ b/src/discussions/in-context-topics/topic/Topic.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { useParams } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; import { useIntl } from '@edx/frontend-platform/i18n'; @@ -10,7 +10,7 @@ import TopicStats from '../../../components/TopicStats'; import { Routes } from '../../../data/constants'; import { discussionsPath } from '../../utils'; import messages from '../messages'; -import { useNavigate } from 'react-router-dom'; + const Topic = ({ topic, @@ -36,13 +36,14 @@ const Topic = ({ navigate(topicUrl()); }} onKeyDown={(e) => { - if (e.key === "Enter" || e.key === " ") { + if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); isSelected(topic.id); navigate(topicUrl()); } }} aria-current={isSelected(topic.id) ? 'page' : undefined} + aria-selected={isSelected(topic.id)} role="option" tabIndex={(isSelected(topic.id) || index === 0) ? 0 : -1} style={{ cursor: 'pointer' }}