Skip to content

Made icons inside topic module tab accessible #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/TinyMCEEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
relative_urls: false,
default_link_target: '_blank',
target_list: false,
placeholder: props.placeholder,

Check failure on line 155 in src/components/TinyMCEEditor.jsx

View workflow job for this annotation

GitHub Actions / tests

'placeholder' is missing in props validation
images_upload_handler: uploadHandler,
setup,
}}
Expand Down
4 changes: 2 additions & 2 deletions src/components/TopicStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</Tooltip>
)}
>
<div className="d-flex align-items-center mr-3.5">
<div className="d-flex align-items-center mr-3.5" tabIndex={0}>

Check failure on line 42 in src/components/TopicStats.jsx

View workflow job for this annotation

GitHub Actions / tests

`tabIndex` should only be declared on interactive elements
<Icon src={PostOutline} className="icon-size mr-2" />
{threadCounts?.discussion || 0}
</div>
Expand All @@ -57,7 +57,7 @@
</Tooltip>
)}
>
<div className="d-flex align-items-center mr-3.5">
<div className="d-flex align-items-center mr-3.5" tabIndex={0}>

Check failure on line 60 in src/components/TopicStats.jsx

View workflow job for this annotation

GitHub Actions / tests

`tabIndex` should only be declared on interactive elements
<Icon src={HelpOutline} className="icon-size mr-2" />
{threadCounts?.question || 0}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/discussions-home/DiscussionsHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const DiscussionsHome = () => {
<Suspense fallback={(<Spinner />)}>
<DiscussionContext.Provider value={discussionContextValue}>
{!enableInContextSidebar && (<Header courseOrg={org} courseNumber={courseNumber} courseTitle={courseTitle} />)}
<main className="container-fluid d-flex flex-column p-0 w-100 font-size" id="main" tabIndex="-1">
<main className="container-fluid d-flex flex-column p-0 w-100 font-size" id="main-content" tabIndex="-1">
{!enableInContextSidebar && <CourseTabsNavigation />}
{(isEnrolled || !isUserLearner) && (
<div
Expand Down
27 changes: 19 additions & 8 deletions src/discussions/in-context-topics/topic/Topic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import PropTypes from 'prop-types';

import classNames from 'classnames';
import { Link, useParams } from 'react-router-dom';
import { useNavigate, useParams } from 'react-router-dom';

import { useIntl } from '@edx/frontend-platform/i18n';

Expand All @@ -11,13 +11,15 @@
import { discussionsPath } from '../../utils';
import messages from '../messages';


Check failure on line 14 in src/discussions/in-context-topics/topic/Topic.jsx

View workflow job for this annotation

GitHub Actions / tests

More than 1 blank line not allowed
const Topic = ({
topic,
showDivider,
index,
}) => {
const intl = useIntl();
const { courseId } = useParams();
const navigate = useNavigate();
const isSelected = (id) => window.location.pathname.includes(id);
const topicUrl = discussionsPath(Routes.TOPICS.TOPIC, {
courseId,
Expand All @@ -26,16 +28,25 @@

return (
<>
<Link
className={classNames('discussion-topic p-0 text-decoration-none text-primary-500', {
'border-light-400 border-bottom': showDivider,
})}
<div
className={classNames('discussion-topic p-0 text-decoration-none text-primary-500', { 'border-light-400 border-bottom': showDivider })}
data-topic-id={topic.id}
to={topicUrl()}
onClick={() => 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}
aria-selected={isSelected(topic.id)}
role="option"
tabIndex={(isSelected(topic.id) || index === 0) ? 0 : -1}
style={{ cursor: 'pointer' }}
>
<div className="d-flex flex-row pt-2.5 pb-2 px-4">
<div className="d-flex flex-column flex-fill" style={{ minWidth: 0 }}>
Expand All @@ -47,7 +58,7 @@
<TopicStats threadCounts={topic?.threadCounts} />
</div>
</div>
</Link>
</div>
{!showDivider && (
<>
<div className="divider border-top border-light-500" />
Expand Down
Loading