Skip to content

Commit

Permalink
ARIA regions for response lists.
Browse files Browse the repository at this point in the history
See #109.
  • Loading branch information
boonebgorges committed May 1, 2018
1 parent 7fd0e65 commit ebff122
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
17 changes: 12 additions & 5 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16317,7 +16317,7 @@ const EditSaveButtonContainer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_
const mapStateToProps = (state, ownProps) => {
const {
attachments, collapsed, editing, feedback, formData, initialLoadComplete,
questions, responseIdMap, responses, routing
questions, responseFormPending, responseIdMap, responses, routing
} = state;

const { itemId } = ownProps;
Expand All @@ -16337,6 +16337,7 @@ const mapStateToProps = (state, ownProps) => {
const isEditing = editing.hasOwnProperty(itemId);

const isPending = formData.hasOwnProperty('question-' + itemId) && formData['question-' + itemId].isPending;
const responseIsPending = responseFormPending.hasOwnProperty(itemId) && responseFormPending[itemId];

const routeBase = window.WWData.route_base;
const questionLink = '/' + routeBase + '#:problemId=' + question.problemId + ':questionId=' + itemId;
Expand Down Expand Up @@ -16376,6 +16377,7 @@ const mapStateToProps = (state, ownProps) => {
questionLink,
questionStatus,
responseIds,
responseIsPending,
responses,
userCanEdit,
userCanPostResponse: window.WWData.user_can_post_response > 0,
Expand Down Expand Up @@ -37688,7 +37690,8 @@ class Question extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {
componentDidMount() {
const {
isCurrentQuestion, isSingleProblem,
itemId, initialLoadComplete, userCanPostResponse
itemId, initialLoadComplete,
userCanPostResponse
} = this.props;

if (!isSingleProblem) {
Expand Down Expand Up @@ -37723,7 +37726,7 @@ class Question extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {
responseIds, responses, userCanEdit, userCanPostResponse,
onAccordionClick, onDeleteClick, onEditClick, onEditSaveClick,
onProblemSummaryClick, onRespondClick, onWaypointEnter,
userCanSubscribe
responseIsPending, userCanSubscribe
} = this.props;

const {
Expand Down Expand Up @@ -38120,6 +38123,7 @@ class Question extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {
{ className: isCollapsed ? 'accordion-content accordion-closed' : 'accordion-content accordion-open' },
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__ResponseList__["a" /* default */], {
isMyQuestion: isMyQuestion,
isPending: responseIsPending,
questionId: itemId,
responseIds: responseIds,
responses: responses
Expand Down Expand Up @@ -38970,7 +38974,7 @@ class ResponseForm extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {

class ResponseList extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {
render() {
const { isMyQuestion, questionId, responseIds } = this.props;
const { isMyQuestion, isPending, questionId, responseIds } = this.props;
const responseScrollElementName = 'response-form-' + questionId;

var rows = [];
Expand Down Expand Up @@ -39002,7 +39006,10 @@ class ResponseList extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] {
{ className: 'ww-response-list' },
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'ul',
null,
{
'aria-busy': isPending,
'aria-live': 'polite'
},
rows
)
);
Expand Down
2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/components/Question.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default class Question extends Component {
componentDidMount() {
const {
isCurrentQuestion, isSingleProblem,
itemId, initialLoadComplete, userCanPostResponse
itemId, initialLoadComplete,
userCanPostResponse
} = this.props

if ( ! isSingleProblem ) {
Expand Down Expand Up @@ -51,7 +52,7 @@ export default class Question extends Component {
responseIds, responses, userCanEdit, userCanPostResponse,
onAccordionClick, onDeleteClick, onEditClick, onEditSaveClick,
onProblemSummaryClick, onRespondClick, onWaypointEnter,
userCanSubscribe
responseIsPending, userCanSubscribe
} = this.props

const {
Expand Down Expand Up @@ -410,6 +411,7 @@ export default class Question extends Component {
<div className={isCollapsed ? 'accordion-content accordion-closed' : 'accordion-content accordion-open'}>
<ResponseList
isMyQuestion={isMyQuestion}
isPending={responseIsPending}
questionId={itemId}
responseIds={responseIds}
responses={responses}
Expand Down
9 changes: 5 additions & 4 deletions src/components/ResponseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Element } from 'react-scroll'

export default class ResponseList extends Component {
render() {
const { isMyQuestion, questionId, responseIds } = this.props
const { isMyQuestion, isPending, questionId, responseIds } = this.props
const responseScrollElementName = 'response-form-' + questionId

var rows = [];
Expand Down Expand Up @@ -34,9 +34,10 @@ export default class ResponseList extends Component {

return (
<div className="ww-response-list">
<ul>
{rows}
</ul>
<ul
aria-busy={isPending}
aria-live="polite"
>{rows}</ul>
</div>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/containers/QuestionContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { attachmentShortcodeRegExp } from '../util/webwork-text-formatter'
const mapStateToProps = (state, ownProps) => {
const {
attachments, collapsed, editing, feedback, formData, initialLoadComplete,
questions, responseIdMap, responses, routing
questions, responseFormPending, responseIdMap, responses, routing
} = state

const { itemId } = ownProps
Expand All @@ -28,6 +28,7 @@ const mapStateToProps = (state, ownProps) => {
const isEditing = editing.hasOwnProperty( itemId )

const isPending = formData.hasOwnProperty( 'question-' + itemId ) && formData[ 'question-' + itemId ].isPending
const responseIsPending = responseFormPending.hasOwnProperty( itemId ) && responseFormPending[ itemId ]

const routeBase = window.WWData.route_base
const questionLink = '/'
Expand Down Expand Up @@ -72,6 +73,7 @@ const mapStateToProps = (state, ownProps) => {
questionLink,
questionStatus,
responseIds,
responseIsPending,
responses,
userCanEdit,
userCanPostResponse: window.WWData.user_can_post_response > 0,
Expand Down

0 comments on commit ebff122

Please sign in to comment.