Skip to content

Improve Accessibility for Expand/Collapse Functionality on Course Home Page #1694

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 1 commit 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
2 changes: 1 addition & 1 deletion src/course-home/outline-tab/OutlineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const OutlineTab = () => {
<>
<div id="expand-button-row" className="row w-100 m-0 mb-3 justify-content-end">
<div className="col-12 col-md-auto p-0">
<Button ref={expandButtonRef} variant="outline-primary" block onClick={() => { setExpandAll(!expandAll); }}>
<Button ref={expandButtonRef} variant="outline-primary" block onClick={() => { setExpandAll(!expandAll); }} aria-label={`${expandAll ? intl.formatMessage(messages.collapseAll) : intl.formatMessage(messages.expandAll)} sections`}>
{expandAll ? intl.formatMessage(messages.collapseAll) : intl.formatMessage(messages.expandAll)}
</Button>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/course-home/outline-tab/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,14 @@ const messages = defineMessages({
},
openSection: {
id: 'learning.outline.altText.openSection',
defaultMessage: 'Open',
defaultMessage: 'Open Section',
description: 'A button to open the given section of the course outline',
},
closeSection: {
id: 'learning.outline.altText.closeSection',
defaultMessage: 'Close Section',
description: 'A button to close the given section of the course outline',
},
proctoringInfoPanel: {
id: 'learning.proctoringPanel.header',
defaultMessage: 'This course contains proctored exams',
Expand Down
5 changes: 2 additions & 3 deletions src/course-home/outline-tab/section-outline/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Collapsible, IconButton } from '@openedx/paragon';
import { Minus, Plus } from '@openedx/paragon/icons';

import { useModel } from '../../../generic/model-store';
import genericMessages from '../../../generic/messages';
import { useContextId } from '../../../data/hooks';
import messages from '../messages';
import SectionTitle from './SectionTitle';
Expand Down Expand Up @@ -61,15 +60,15 @@ const Section: React.FC<Props> = ({
onToggle={() => { setOpen(!open); }}
iconWhenClosed={(
<IconButton
alt={intl.formatMessage(messages.openSection)}
alt={`${intl.formatMessage(messages.openSection)} ${title}`}
iconAs={Plus}
onClick={() => { setOpen(true); }}
size="sm"
/>
)}
iconWhenOpen={(
<IconButton
alt={intl.formatMessage(genericMessages.close)}
alt={`${intl.formatMessage(messages.closeSection)} ${title}`}
iconAs={Minus}
onClick={() => { setOpen(false); }}
size="sm"
Expand Down