-
Notifications
You must be signed in to change notification settings - Fork 297
feat: improved accessibility for Show/Hide Accordions #1811
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
Draft
filippovskii09
wants to merge
6
commits into
openedx:master
Choose a base branch
from
raccoongang:filippovskii/feat/transfer-accessibility-to-show/hide-accordions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−4
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8746c9c
feat: improved accessibility for Show/Hide Accordions
vladislavkeblysh fbbe11d
feat: remove extra class and use heading from paragon
filippovskii09 65610f5
feat: improved accessibility for Show/Hide Accordions
vladislavkeblysh 6d83608
fix: refactor and fix errors
filippovskii09 f113616
fix: remove extra jsx file
filippovskii09 855d5ee
fix: remove extra code
filippovskii09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: improved accessibility for Show/Hide Accordions
- Loading branch information
commit 65610f58847269d7823d40f31fdfbee43cc0a3ec
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import React, { useEffect, useState } from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; | ||
| import { Collapsible, IconButton, Icon } from '@openedx/paragon'; | ||
| import { faCheckCircle as fasCheckCircle, faMinus, faPlus } from '@fortawesome/free-solid-svg-icons'; | ||
| import { faCheckCircle as farCheckCircle } from '@fortawesome/free-regular-svg-icons'; | ||
| import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
|
|
||
| import { DisabledVisible } from '@openedx/paragon/icons'; | ||
| import SequenceLink from './SequenceLink'; | ||
|
Check failure on line 10 in src/course-home/outline-tab/Section.jsx
|
||
| import { useModel } from '../../generic/model-store'; | ||
|
|
||
| import genericMessages from '../../generic/messages'; | ||
| import messages from './messages'; | ||
|
|
||
| const Section = ({ | ||
| courseId, | ||
| defaultOpen, | ||
| expand, | ||
| intl, | ||
| section, | ||
| }) => { | ||
| const { | ||
| complete, | ||
| sequenceIds, | ||
| title, | ||
| hideFromTOC, | ||
| } = section; | ||
| const { | ||
| courseBlocks: { | ||
| sequences, | ||
| }, | ||
| } = useModel('outline', courseId); | ||
|
|
||
| const [open, setOpen] = useState(defaultOpen); | ||
|
|
||
| useEffect(() => { | ||
| setOpen(expand); | ||
| }, [expand]); | ||
|
|
||
| useEffect(() => { | ||
| setOpen(defaultOpen); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, []); | ||
|
|
||
| const sectionTitle = ( | ||
| <div className="d-flex row w-100 m-0"> | ||
| <div className="col-auto p-0"> | ||
| {complete ? ( | ||
| <FontAwesomeIcon | ||
| icon={fasCheckCircle} | ||
| fixedWidth | ||
| className="float-left mt-1 text-success" | ||
| aria-hidden="true" | ||
| title={intl.formatMessage(messages.completedSection)} | ||
| /> | ||
| ) : ( | ||
| <FontAwesomeIcon | ||
| icon={farCheckCircle} | ||
| fixedWidth | ||
| className="float-left mt-1 text-gray-400" | ||
| aria-hidden="true" | ||
| title={intl.formatMessage(messages.incompleteSection)} | ||
| /> | ||
| )} | ||
| </div> | ||
| <div className="col-7 ml-3 p-0 font-weight-bold text-dark-500"> | ||
| <h2 className="course-outline-tab-section-title text-dark-500 mb-0"> | ||
| <span className="align-middle col-6">{title}</span> | ||
| </h2> | ||
| <span className="sr-only"> | ||
| , {intl.formatMessage(complete ? messages.completedSection : messages.incompleteSection)} | ||
| </span> | ||
| </div> | ||
| {hideFromTOC && ( | ||
| <div className="row"> | ||
| {hideFromTOC && ( | ||
| <span className="small d-flex align-content-end"> | ||
| <Icon className="mr-2" src={DisabledVisible} data-testid="hide-from-toc-section-icon" /> | ||
| <span data-testid="hide-from-toc-section-text"> | ||
| {intl.formatMessage(messages.hiddenSection)} | ||
| </span> | ||
| </span> | ||
| )} | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
|
|
||
| return ( | ||
| <li> | ||
| <Collapsible | ||
| className="mb-2" | ||
| styling="card-lg" | ||
| title={sectionTitle} | ||
| open={open} | ||
| onToggle={() => { setOpen(!open); }} | ||
| iconWhenClosed={( | ||
| <IconButton | ||
| alt={intl.formatMessage(messages.openSection)} | ||
| icon={faPlus} | ||
| onClick={() => { setOpen(true); }} | ||
| size="sm" | ||
| /> | ||
| )} | ||
| iconWhenOpen={( | ||
| <IconButton | ||
| alt={intl.formatMessage(genericMessages.close)} | ||
| icon={faMinus} | ||
| onClick={() => { setOpen(false); }} | ||
| size="sm" | ||
| /> | ||
| )} | ||
| > | ||
| <ol className="list-unstyled"> | ||
| {sequenceIds.map((sequenceId, index) => ( | ||
| <SequenceLink | ||
| key={sequenceId} | ||
| id={sequenceId} | ||
| courseId={courseId} | ||
| sequence={sequences[sequenceId]} | ||
| first={index === 0} | ||
| /> | ||
| ))} | ||
| </ol> | ||
| </Collapsible> | ||
| </li> | ||
| ); | ||
| }; | ||
|
|
||
| Section.propTypes = { | ||
| courseId: PropTypes.string.isRequired, | ||
| defaultOpen: PropTypes.bool.isRequired, | ||
| expand: PropTypes.bool.isRequired, | ||
| intl: intlShape.isRequired, | ||
| section: PropTypes.shape().isRequired, | ||
| }; | ||
|
|
||
| export default injectIntl(Section); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .course-outline-tab-section-title { | ||
| font-size: $font-size-base; | ||
| line-height: $line-height-base; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[important]: We need to verify what do we need to do with UpsellBullets.scss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was removed, no errors occurred