FrontFest, Moscow 2017
Léonie Watson ~ The Paciello Group
Software that translates on-screen content into synthetic speech
<input type="checkbox" id="bold">
<label for="bold">Bold</label>
Define how role, state, properties, and keyboard focus for native elements are handled in the browser
Browsers may support an element, but not accessibility support it
details and summary elements<details>
<summary>Tequila...</summary>
Makes me happy!
</details>
Attributes that polyfill missing role, name, and state information for screen readers
role attribute70+ roles, including:
aria- attributes45+ states and properties, including:
aria-invalid, aria-requiredaria-pressed, aria-expandedaria-controls, aria-ownsdetails and summary elements<details>
<summary id="button">Tequila...</summary>
<div id="content">Makes me happy!</div>
</details>
var button = document.getElementById('button');
var content = document.getElementById('content');
role="button"button.setAttribute('role', 'button');
tabindex="0"button.setAttribute('tabindex', 0);
aria-expanded="false"button.setAttribute('aria-expanded', 'false');
hidden attributecontent.setAttribute('hidden', 'true');
<details>
<summary id="button" role="button" tabindex="0" aria-expanded="false">
Tequila...
</summary>
<div id="content" hidden>Makes me happy!</div>Makes me happy!
</details>
function disclose(event) {
if (content.hasAttribute('hidden')) {
button.setAttribute('aria-expanded', 'true');
content.removeAttribute('hidden');
}
else {
button.setAttribute('aria-expanded', 'false');
content.setAttribute('hidden', 'true');
}
}
button.addEventListener('click', disclose, false);
button.addEventListener('keydown', function(event) {
if (event.keyCode == 13 || event.keyCode ==32) {
disclose();
}
});
Experimental JavaScript API that enables developers to modify the accessibility tree
Has landed in Chrome Canary behind the flag:
--enable-blink-features=AccessibilityObjectModel
details and summary elements<details>
<summary id="button">Tequila...</summary>
<div id="content">Makes me happy!</div>
</details>
var button = document.getElementById('button');
var content = document.getElementById('content');
button.setAttribute('tabindex', 0);
content.setAttribute('hidden', true);
button propertybutton.accessibleNode.role = "button";
expanded propertybutton.accessibleNode.expanded = false;
var references = new AccessibleNodeList();
references.add(content.accessibleNode);
function disclose(event) {
if(content.getAttribute('hidden')) {
button.accessibleNode.expanded = true;
button.accessibleNode.controls = content;
content.removeAttribute('hidden');
}
else {
button.accessibleNode.expanded = false;
button.accessibleNode.controls = null;
content.setAttribute('hidden', true);
}
}
button.addEventListener('click', disclose, false);
button.addEventListener('keydown', function(event) {
if (event.keyCode == 13 || event.keyCode ==32) {
disclose();
}
});
Léonie Watson ~ The Paciello Group