Skip to content

Commit

Permalink
ucfopen#2 Fixed screen reader keyboard instructions to refer to the c…
Browse files Browse the repository at this point in the history
…orrect key for reading out the entire paragraph. Adjusted the control+Enter listener's behavior to dynamically build the entire paragraph and substitute the current input values where applicable.
  • Loading branch information
FrenjaminBanklin committed Jul 31, 2023
1 parent 15bf7e4 commit 0d439bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/player-events.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,21 @@ Namespace('Wordguess').Events = do ->
if e.ctrlKey and e.code == 'Enter'
e.preventDefault()
e.stopPropagation()
document.getElementById('aria-live').innerHTML = 'Now reading entire paragraph: ' + paragraph

live = paragraph.split(';BLANK;')
inputs = gameParagraph.getElementsByTagName('input')

final = []
for i in [0..live.length - 1]
final.push(live[i])
if i < live.length - 1
if inputs[i].value != ''
final.push inputs[i].value
else
final.push ';BLANK;'
final = final.join('')

document.getElementById('aria-live').innerHTML = 'Now reading entire paragraph: ' + final
if e.ctrlKey and e.code == 'Space'
e.preventDefault()
e.stopPropagation()
Expand Down
2 changes: 1 addition & 1 deletion src/player.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Namespace('Wordguess').Engine = do ->
'. You will be presented a paragraph with some words left blank. ' +
'Fill in the missing blanks with the words you think belong. ' +
'Use the Tab key to move between blank words. ' +
'Hold the Control key and press Escape to hear the entire paragraph along with the blanks. ' +
'Hold the Control key and press Enter or Return to hear the entire paragraph along with any unfilled blanks. ' +
'Hold the Control key and press Space to hear these instructions again. '
'Click or press any key to begin.'

Expand Down

0 comments on commit 0d439bd

Please sign in to comment.