I am focused on creating accessible web content for visually impaired individuals utilizing the Jaws screen reader in conjunction with a voice synthesizer. My development involves XHTML and WAI-ARIA along with JavaScript to ensure a user-friendly experience for questionnaire testing that accommodates screen readers.
A significant challenge arises due to the inconsistent behavior across various browsers and different versions of the Jaws screen reader, particularly since the release of Firefox 4 and its update 4.01.
The same code used for a web questionnaire designed for blind users is malfunctioning in the Firefox 4.01 update.
It seems that certain JavaScript functions are now unsupported. Notably, even when the screen reader is disabled, the tab key now fails to function correctly, which is problematic.
Previously, in earlier versions of Firefox, navigation was seamless. In comparison, Internet Explorer versions 8 and 9 also experience tab navigation issues, for reasons that remain unclear.
Here’s a snippet of the code associated with a questionnaire form featuring radio buttons targeting user testing, which contains multiple input types including combo boxes and submission buttons.
The expected behavior for the radio buttons and other interactive components is that users can cycle through the options via the tab key. If the user neglects to select an option, a voice prompt will alert them: ‘Please, specify your visual impairment!’ and redirect focus back to the first radio button. Conversely, if a selection is made, focus shifts to the next available input.
Each form component (like the radio button) triggers two events:
onFocus
, for the initial element focus,onBlur
, for when the focus changes.
Is there an aspect I may have overlooked?
CODE SAMPLE:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
<head>
<script type="text/javascript">
function clearPreviousAlert() {
const previousAlert = document.getElementById("alert");
if (previousAlert) document.body.removeChild(previousAlert);
}
function displayAlert(message) {
clearPreviousAlert();
const alertDiv = document.createElement("div");
alertDiv.setAttribute("role", "alert");
alertDiv.setAttribute("aria-live", "assertive");
alertDiv.setAttribute("id", "alert");
alertDiv.appendChild(document.createTextNode(message));
document.body.appendChild(alertDiv);
}
function validateSelection(elementId, index, alertMsg) {
const element = document.getElementById(elementId);
let allInvalid = true;
const options = document.questionnaire.visibilityOptions;
for (let i = 0; i < options.length; i++) {
if (options[i].checked) {
allInvalid = false;
}
}
if (allInvalid) {
element.setAttribute("aria-invalid", "true");
if (index === options.length - 1) displayAlert(alertMsg);
} else {
element.setAttribute("aria-invalid", "false");
clearPreviousAlert();
}
return allInvalid;
}
function proceed(acknowledgement, ...) {
if (acknowledgement) {
//...
} else {
focusOnFirstOption();
}
}
function isResponseValid(...invalids) {
return invalids.every(invalid => !invalid);
}
</script>
</head>
<body onload="initializeForm();">
<form id="questionnaire" name="questionnaire" action="http://...questionnaire.php" method="POST" onsubmit="return isResponseValid(invalid, ...);">
<div role="dialog" aria-labelledby="visualDisabilityTitle">
<h2 id="visualDisabilityTitle"><b>3) Type of Visual Disability:</b><br/><br/></h2>
<input type="radio" required id="disabilityType0" name="disabilityType" value="Blind" onfocus="proceed(invalid, ...);" onblur="invalid = validateSelection('disabilityType0', 0, 'Please, specify your visual impairment!');" />
<label for="disabilityType0">Non vedente<br/></label>
<input type="radio" required id="disabilityType1" name="disabilityType" value="Visually Impaired" onblur="invalid = validateSelection('disabilityType1', 1, 'Please, specify your visual impairment!');" />
<label for="disabilityType1">Ipovedente<br/></label>
<input type="radio" required id="disabilityType2" name="disabilityType" value="None" onblur="invalid = validateSelection('disabilityType2', 2, 'Please, specify your visual impairment!');" />
<label for="disabilityType2">Nessuna<br/></label>
</div><br/>
</form>
</body>
</html>