forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add accessibility page (openedx#861)
* feat: add accessibility page * fix: lint errors * feat: increase code coverage * fix: lint errors
- Loading branch information
1 parent
40c9d6e
commit f717cda
Showing
18 changed files
with
885 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
src/accessibility-page/AccessibilityBody/AccessibilityBody.jsx
This file contains 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,98 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
import { Hyperlink, MailtoLink, Stack } from '@openedx/paragon'; | ||
|
||
import messages from './messages'; | ||
|
||
const AccessibilityBody = ({ | ||
communityAccessibilityLink, | ||
email, | ||
}) => ( | ||
<div className="mt-5"> | ||
<header> | ||
<h2 className="mb-4 pb-1"> | ||
<FormattedMessage {...messages.a11yBodyPageHeader} /> | ||
</h2> | ||
</header> | ||
<Stack gap={2.5}> | ||
<div className="small"> | ||
<FormattedMessage | ||
{...messages.a11yBodyIntroGraph} | ||
values={{ | ||
communityAccessibilityLink: ( | ||
<Hyperlink | ||
destination={communityAccessibilityLink} | ||
data-testid="accessibility-page-link" | ||
> | ||
Website Accessibility Policy | ||
</Hyperlink> | ||
), | ||
}} | ||
/> | ||
</div> | ||
<div className="small"> | ||
<FormattedMessage {...messages.a11yBodyStepsHeader} /> | ||
</div> | ||
<ol className="small m-0"> | ||
<li> | ||
<FormattedMessage | ||
{...messages.a11yBodyEmailHeading} | ||
values={{ | ||
emailElement: ( | ||
<MailtoLink | ||
to={email} | ||
data-testid="email-element" | ||
> | ||
{email} | ||
</MailtoLink> | ||
), | ||
}} | ||
/> | ||
<ul> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyNameEmail} /> | ||
</li> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyInstitution} /> | ||
</li> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyBarrier} /> | ||
</li> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyTimeConstraints} /> | ||
</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyReceipt} /> | ||
</li> | ||
<li> | ||
<FormattedMessage {...messages.a11yBodyExtraInfo} /> | ||
</li> | ||
</ol> | ||
<div className="small"> | ||
<FormattedMessage | ||
{...messages.a11yBodyA11yFeedback} | ||
values={{ | ||
emailElement: ( | ||
<MailtoLink | ||
to={email} | ||
data-testid="email-element" | ||
> | ||
{email} | ||
</MailtoLink> | ||
), | ||
}} | ||
/> | ||
</div> | ||
</Stack> | ||
</div> | ||
); | ||
|
||
AccessibilityBody.propTypes = { | ||
communityAccessibilityLink: PropTypes.string.isRequired, | ||
email: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default injectIntl(AccessibilityBody); |
46 changes: 46 additions & 0 deletions
46
src/accessibility-page/AccessibilityBody/AccessibilityBody.test.jsx
This file contains 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,46 @@ | ||
import { | ||
render, | ||
screen, | ||
} from '@testing-library/react'; | ||
import { AppProvider } from '@edx/frontend-platform/react'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { initializeMockApp } from '@edx/frontend-platform'; | ||
import initializeStore from '../../store'; | ||
|
||
import AccessibilityBody from './index'; | ||
|
||
let store; | ||
|
||
const renderComponent = () => { | ||
render( | ||
<IntlProvider locale="en"> | ||
<AppProvider store={store}> | ||
<AccessibilityBody | ||
communityAccessibilityLink="http://example.com" | ||
email="[email protected]" | ||
/> | ||
</AppProvider> | ||
</IntlProvider>, | ||
); | ||
}; | ||
|
||
describe('<AccessibilityBody />', () => { | ||
describe('renders', () => { | ||
beforeEach(async () => { | ||
initializeMockApp({ | ||
authenticatedUser: { | ||
userId: 3, | ||
username: 'abc123', | ||
administrator: false, | ||
roles: [], | ||
}, | ||
}); | ||
store = initializeStore({}); | ||
}); | ||
it('contains links', () => { | ||
renderComponent(); | ||
expect(screen.getAllByTestId('email-element')).toHaveLength(2); | ||
expect(screen.getAllByTestId('accessibility-page-link')).toHaveLength(1); | ||
}); | ||
}); | ||
}); |
This file contains 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,3 @@ | ||
import AccessibilityBody from './AccessibilityBody'; | ||
|
||
export default AccessibilityBody; |
This file contains 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,111 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
|
||
const messages = defineMessages({ | ||
a11yBodyPolicyLink: { | ||
id: 'a11yBodyPolicyLink', | ||
defaultMessage: 'Website Accessibility Policy', | ||
description: 'Title for link to full accessibility policy.', | ||
}, | ||
a11yBodyPageHeader: { | ||
id: 'a11yBodyPageHeader', | ||
defaultMessage: 'Individualized Accessibility Process for Course Creators', | ||
description: 'Heading for studio\'s accessibility policy page.', | ||
}, | ||
a11yBodyIntroGraph: { | ||
id: 'a11yBodyIntroGraph', | ||
defaultMessage: `At edX, we seek to understand and respect the unique needs and perspectives of the edX global community. | ||
We value every course team and are committed to expanding access to all, including course team creators and authors with | ||
disabilities. To that end, we have adopted a {communityAccessibilityLink} and this process to allow course team creators | ||
and authors to request assistance if they are unable to develop and post content on our platform via Studio because of their | ||
disabilities.`, | ||
description: 'Introductory paragraph outlining why we care about accessibility, and what we\'re doing about it.', | ||
}, | ||
a11yBodyStepsHeader: { | ||
id: 'a11yBodyStepsHeader', | ||
defaultMessage: 'Course team creators and authors needing such assistance should take the following steps:', | ||
description: 'Heading for list of steps authors can take for accessibility requests.', | ||
}, | ||
a11yBodyEdxResponse: { | ||
id: 'a11yBodyEdxResponse', | ||
defaultMessage: `'We will communicate with you about your preferences and needs in determining the appropriate solution, although | ||
the ultimate decision will be ours, provided that the solution is effective and timely. The factors we will consider in choosing | ||
an accessibility solution are: effectiveness; timeliness (relative to your deadlines); ease of implementation; and ease of use for | ||
you. We will notify you of the decision and explain the basis for our decision within 10 business days of discussing with you.`, | ||
description: 'Paragraph outlining how we will select an accessibility solution.', | ||
}, | ||
a11yBodyEdxFollowUp: { | ||
id: 'a11yBodyEdxFollowUp', | ||
defaultMessage: `Thereafter, we will communicate with you on a weekly basis regarding our evaluation, decision, and progress in | ||
implementing the accessibility solution. We will notify you when implementation of your accessibility solution is complete and | ||
will follow-up with you as may be necessary to see if the solution was effective.`, | ||
description: 'Paragraph outlining how we will follow-up with you during and after implementing an accessibility solution.', | ||
}, | ||
a11yBodyOngoingSupport: { | ||
id: 'a11yBodyOngoingSupport', | ||
defaultMessage: 'EdX will provide ongoing technical support as needed and will address any additional issues that arise after the initial course creation.', | ||
description: 'A statement of ongoing support.', | ||
}, | ||
a11yBodyA11yFeedback: { | ||
id: 'a11yBodyA11yFeedback', | ||
defaultMessage: 'Please direct any questions or suggestions on how to improve the accessibility of Studio to {emailElement} or use the form below. We welcome your feedback.', | ||
description: 'Contact information heading for those with accessibility issues or suggestions.', | ||
}, | ||
a11yBodyEmailHeading: { | ||
id: 'a11yBodyEmailHeading', | ||
defaultMessage: 'Send an email to {emailElement} with the following information:', | ||
description: 'Heading for list of information required when you email us.', | ||
}, | ||
a11yBodyNameEmail: { | ||
id: 'a11yBodyNameEmail', | ||
defaultMessage: 'your name and email address;', | ||
description: 'Your contact information.', | ||
}, | ||
a11yBodyInstitution: { | ||
id: 'a11yBodyInstitution', | ||
defaultMessage: 'the edX member institution that you are affiliated with;', | ||
description: 'edX affiliate information.', | ||
}, | ||
a11yBodyBarrier: { | ||
id: 'a11yBodyBarrier', | ||
defaultMessage: 'a brief description of the challenge or barrier to access that you are experiencing; and', | ||
description: 'Accessibility problem information.', | ||
}, | ||
a11yBodyTimeConstraints: { | ||
id: 'a11yBodyTimeConstraints', | ||
defaultMessage: 'how soon you need access and for how long (e.g., a planned course start date or in connection with a course-related deadline such as a final essay).', | ||
description: 'Time contstraint information.', | ||
}, | ||
a11yBodyReceipt: { | ||
id: 'a11yBodyReceipt', | ||
defaultMessage: 'The edX Support Team will respond to confirm receipt and forward your request to the edX Partner Manager for your institution and the edX Website Accessibility Specialist.', | ||
description: 'Paragraph outlining what steps edX will take immediately.', | ||
}, | ||
a11yBodyExtraInfo: { | ||
id: 'a11yBodyExtraInfo', | ||
defaultMessage: `With guidance from the Website Accessibility Specialist, edX will contact you to discuss your request and gather | ||
additional information from you about your preferences and needs, to determine if there's a workable solution that edX is able to support.`, | ||
description: 'Paragraph outlining how and when edX will reach out to you.', | ||
}, | ||
a11yBodyFixesListHeader: { | ||
id: 'a11yBodyFixesListHeader', | ||
defaultMessage: 'EdX will assist you promptly and thoroughly so that you are able to create content on the CMS within your time constraints. Such efforts may include, but are not limited to:', | ||
description: 'Heading for list of ways we might be able to assist.', | ||
}, | ||
a11yBodyThirdParty: { | ||
id: 'a11yBodyThirdParty', | ||
defaultMessage: 'Purchasing a third-party tool or software for use on an individual basis to assist your use of Studio;', | ||
description: 'Buy third-party software.', | ||
}, | ||
a11yBodyContractor: { | ||
id: 'a11yBodyContractor', | ||
defaultMessage: 'Engaging a trained independent contractor to provide real-time visual, verbal and physical assistance; or', | ||
description: 'Hire a contractor.', | ||
}, | ||
a11yBodyCodeFix: { | ||
id: 'a11yBodyCodeFix', | ||
defaultMessage: 'Developing new code to implement a technical fix.', | ||
description: 'Make a technical fix.', | ||
}, | ||
}); | ||
|
||
export default messages; |
Oops, something went wrong.