Skip to content

Commit

Permalink
#27 Added tab indices to numerous elements so they are reachable in t…
Browse files Browse the repository at this point in the history
…he tab order. Adjusted aria text for multiple elements and added modest visual effects to indicate when non-interactive elements have focus. Added keyup handler on 'view question' link for keyboard support. Disabled autocomplete on table inputs. Added logic to toggle inert on the game board when a popup is visible.
  • Loading branch information
FrenjaminBanklin committed Jul 11, 2023
1 parent 4f438b5 commit 02fb33e
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 25 deletions.
45 changes: 41 additions & 4 deletions src/__snapshots__/player.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ exports[`Player Render with no question 1`] = `
className="popup help"
>
<div>
<h2>
<h2
aria-label="Secret Spreadsheet widget instructions. Cells of this spreadsheet have been intentionally hidden. Navigate the spreadsheet and input the hidden data until all cells have been filled. Capitalization and punctuation must be precise to match correctly. Navigate the table using your screen reader's dedicated key bindings, or use the tab key to move between blank cells."
tabIndex="0"
>
Secret Spreadsheet - How it works:
</h2>
<div>
Expand All @@ -248,6 +251,7 @@ exports[`Player Render with no question 1`] = `
</div>
<button
onClick={[Function]}
tabIndex="0"
type="button"
value="Got it!"
>
Expand All @@ -265,6 +269,7 @@ exports[`Player Render with no question 1`] = `
to complete the spreadsheet:
</p>
<form
inert="yes"
onSubmit={[Function]}
>
<div
Expand All @@ -290,6 +295,7 @@ exports[`Player Render with no question 1`] = `
id="cell1"
>
<input
autoComplete="off"
className="unanswered"
id="1-input"
onBlur={[Function]}
Expand All @@ -308,6 +314,7 @@ exports[`Player Render with no question 1`] = `
id="cell2"
>
<input
autoComplete="off"
className="unanswered"
id="2-input"
onBlur={[Function]}
Expand Down Expand Up @@ -359,7 +366,10 @@ exports[`Player Render with question and body 1`] = `
className="popup help"
>
<div>
<h2>
<h2
aria-label="Secret Spreadsheet widget instructions. Cells of this spreadsheet have been intentionally hidden. Navigate the spreadsheet and input the hidden data until all cells have been filled. Capitalization and punctuation must be precise to match correctly. Navigate the table using your screen reader's dedicated key bindings, or use the tab key to move between blank cells."
tabIndex="0"
>
Secret Spreadsheet - How it works:
</h2>
<div>
Expand All @@ -383,6 +393,7 @@ exports[`Player Render with question and body 1`] = `
</div>
<button
onClick={[Function]}
tabIndex="0"
type="button"
value="Got it!"
>
Expand All @@ -400,6 +411,7 @@ exports[`Player Render with question and body 1`] = `
to complete the spreadsheet:
</p>
<form
inert="yes"
onSubmit={[Function]}
>
<div
Expand All @@ -425,6 +437,7 @@ exports[`Player Render with question and body 1`] = `
id="cell1"
>
<input
autoComplete="off"
className="unanswered"
id="1-input"
onBlur={[Function]}
Expand All @@ -443,6 +456,7 @@ exports[`Player Render with question and body 1`] = `
id="cell2"
>
<input
autoComplete="off"
className="unanswered"
id="2-input"
onBlur={[Function]}
Expand Down Expand Up @@ -473,8 +487,11 @@ exports[`Player Render with question and body 1`] = `
missing cells
</p>
<p
aria-roledescription="button"
className="link"
onClick={[Function]}
onKeyUp={[Function]}
tabIndex="0"
>
View Question
</p>
Expand All @@ -500,7 +517,10 @@ exports[`Player Render with question and no body 1`] = `
className="popup help"
>
<div>
<h2>
<h2
aria-label="Secret Spreadsheet widget instructions. Cells of this spreadsheet have been intentionally hidden. Navigate the spreadsheet and input the hidden data until all cells have been filled. Capitalization and punctuation must be precise to match correctly. Navigate the table using your screen reader's dedicated key bindings, or use the tab key to move between blank cells."
tabIndex="0"
>
Secret Spreadsheet - How it works:
</h2>
<div>
Expand All @@ -524,6 +544,7 @@ exports[`Player Render with question and no body 1`] = `
</div>
<button
onClick={[Function]}
tabIndex="0"
type="button"
value="Got it!"
>
Expand All @@ -541,6 +562,7 @@ exports[`Player Render with question and no body 1`] = `
to complete the spreadsheet:
</p>
<form
inert="yes"
onSubmit={[Function]}
>
<div
Expand All @@ -566,6 +588,7 @@ exports[`Player Render with question and no body 1`] = `
id="cell1"
>
<input
autoComplete="off"
className="unanswered"
id="1-input"
onBlur={[Function]}
Expand All @@ -584,6 +607,7 @@ exports[`Player Render with question and no body 1`] = `
id="cell2"
>
<input
autoComplete="off"
className="unanswered"
id="2-input"
onBlur={[Function]}
Expand Down Expand Up @@ -614,8 +638,11 @@ exports[`Player Render with question and no body 1`] = `
missing cells
</p>
<p
aria-roledescription="button"
className="link"
onClick={[Function]}
onKeyUp={[Function]}
tabIndex="0"
>
View Question
</p>
Expand All @@ -641,7 +668,10 @@ exports[`Player Render without randomization 1`] = `
className="popup help"
>
<div>
<h2>
<h2
aria-label="Secret Spreadsheet widget instructions. Cells of this spreadsheet have been intentionally hidden. Navigate the spreadsheet and input the hidden data until all cells have been filled. Capitalization and punctuation must be precise to match correctly. Navigate the table using your screen reader's dedicated key bindings, or use the tab key to move between blank cells."
tabIndex="0"
>
Secret Spreadsheet - How it works:
</h2>
<div>
Expand All @@ -665,6 +695,7 @@ exports[`Player Render without randomization 1`] = `
</div>
<button
onClick={[Function]}
tabIndex="0"
type="button"
value="Got it!"
>
Expand All @@ -682,6 +713,7 @@ exports[`Player Render without randomization 1`] = `
to complete the spreadsheet:
</p>
<form
inert="yes"
onSubmit={[Function]}
>
<div
Expand All @@ -707,6 +739,7 @@ exports[`Player Render without randomization 1`] = `
id="cell1"
>
<input
autoComplete="off"
className="unanswered"
id="1-input"
onBlur={[Function]}
Expand All @@ -725,6 +758,7 @@ exports[`Player Render without randomization 1`] = `
id="cell2"
>
<input
autoComplete="off"
className="unanswered"
id="2-input"
onBlur={[Function]}
Expand Down Expand Up @@ -755,8 +789,11 @@ exports[`Player Render without randomization 1`] = `
missing cells
</p>
<p
aria-roledescription="button"
className="link"
onClick={[Function]}
onKeyUp={[Function]}
tabIndex="0"
>
View Question
</p>
Expand Down
2 changes: 2 additions & 0 deletions src/components/player/__snapshots__/cell.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Cell component Rendered with user input center aligned 1`] = `
id={1}
>
<input
autoComplete="off"
className="unanswered"
onBlur={[MockFunction]}
onChange={[Function]}
Expand All @@ -22,6 +23,7 @@ exports[`Cell component Rendered with user input left aligned 1`] = `
id={1}
>
<input
autoComplete="off"
className="unanswered"
onBlur={[MockFunction]}
onChange={[Function]}
Expand Down
6 changes: 5 additions & 1 deletion src/components/player/__snapshots__/popup.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ exports[`Popup component Is rendered 1`] = `
className="popup help"
>
<div>
<h2>
<h2
aria-label="Secret Spreadsheet widget instructions. Cells of this spreadsheet have been intentionally hidden. Navigate the spreadsheet and input the hidden data until all cells have been filled. Capitalization and punctuation must be precise to match correctly. Navigate the table using your screen reader's dedicated key bindings, or use the tab key to move between blank cells."
tabIndex="0"
>
Secret Spreadsheet - How it works:
</h2>
<div>
Expand All @@ -29,6 +32,7 @@ exports[`Popup component Is rendered 1`] = `
</div>
<button
onClick={[MockFunction]}
tabIndex="0"
type="button"
value="Got it!"
>
Expand Down
8 changes: 8 additions & 0 deletions src/components/player/__snapshots__/question.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ exports[`Question component Is rendered with question body 1`] = `
>
<div>
<p
aria-label="Question: Test entry question: Test question body"
className="mainQuestion"
tabIndex="0"
>
Test entry question
</p>
<p>
Test question body
</p>
<button
aria-label="After closing this dialog focus will be automatically moved to the first empty cell in the spreadsheet."
onClick={[MockFunction]}
tabIndex="0"
type="button"
value="Next"
>
Expand All @@ -30,12 +34,16 @@ exports[`Question component Is rendered without question body 1`] = `
>
<div>
<p
aria-label="Question: Test entry question: "
className="mainQuestion"
tabIndex="0"
>
Test entry question
</p>
<button
aria-label="After closing this dialog focus will be automatically moved to the first empty cell in the spreadsheet."
onClick={[MockFunction]}
tabIndex="0"
type="button"
value="Next"
>
Expand Down
Loading

0 comments on commit 02fb33e

Please sign in to comment.