Funka Accessibility Days 2016
Enables simple haptic feedback from webapps
<button id="v1">Vibrate once</button>
<button id="v2">Vibrate twice</button>
<button id="v3">Vibrate more</button>
if ("vibrate" in navigator) {
//Do something.
} else {
alert("Browser does not support the Vibration API");
}
var vibrateOnce = function(e) {
window.navigator.vibrate(500);
};
var vibrateTwice = function(e) {
window.navigator.vibrate([500, 500, 500]);
};
var vibrateMore = function(e) {
window.navigator.vibrate([500, 500, 500, 500, 500]);
};
document.getElementById("v1")
.addEventListener("click", vibrateOnce);
document.getElementById("v2")
.addEventListener("click", vibrateTwice);
document.getElementById("v3")
.addEventListener("click", vibrateMore);
Enables flexible layout control and visual ordering
Pretty much everywhere except IE before 11
<div>
<button>1</button>
<button>2</button>
<button>3</button>
</div>
<div style="display: flex;">
<button style="order: 3;">1</button>
<button style="order: 2;">2</button>
<button style="order: 1;">3</button>
</div>
<div style="display: flex;">
<button style="order: 3;" tabindex="3">1</button>
<button style="order: 2;" tabindex="2">2</button>
<button style="order: 1;" tabindex="1">3</button>
</div>
Authors must use ‘order' only for visual, not logical, reordering of content.
Enables speech input and output for webapps
SpeechSynthesis interface:
SpeechRecognition interface:
<button data-hint="Use space or enter to activate">
Foo
</button>
if (window.SpeechSynthesisUtterance === undefined) {
alert("Browser does not support the Web Speech API");
} else {
// Do something
}
hints = document.querySelectorAll('[data-hint]'),
hoverTimeout;
speakHint = function(e) {
var msg =
new SpeechSynthesisUtterance(e.target.dataset.hint);
window.speechSynthesis.speak(msg);
};
function focusEventListener(e) {
hoverTimeout = window.setTimeout(speakHint, 500, e);
}
function blurEventListener(e) {
window.clearTimeout(hoverTimeout);
}
function mouseoverEventListener(e) {
hoverTimeout = window.setTimeout(speakHint, 500, e);
}
function mouseoutEventListener(e) {
window.clearTimeout(hoverTimeout);
}
hints.forEach(function(hint) {
hint.addEventListener('focus', focusEventListener);
hint.addEventListener('blur', blurEventListener);
hint.addEventListener('mouseover', mouseoverEventListener);
hint.addEventListener('mouseout', mouseoutEventListener);
});
Create graphics that scale without loss of quality, and which can have semantic meaning
Draw on-screen using elements and animations
Pretty much everywhere
<svg width="250" height="100">
<rect x="0" y="0" width="100%" height="100%"
style="fill: #b55fff;" />
</svg>
<svg width="250" height="100">
<circle tabindex="0" cx="125" cy="50" r="32.5"
style="fill: #820bbb;" />
</svg>
<svg width="304" height="290">
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;stroke:#000000;stroke-width:15;
stroke-linejoin:round"/>
</svg>
<svg role="img" width="304" height="290">
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;"/>
</svg>
<svg role="img" width="304" height="290">
<title>Violet pentagram</title>
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;>
</svg>
<svg role="img" width="304" height="290">
<title>Violet pentagram</title>
<desc>Five pointed star</desc>
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;>
</svg>
<svg role="img" aria-labelledby="title"
width="304" height="290">
<title id="title">Violet pentagram</title>
<desc>Five pointed star</desc>
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;>
</svg>
<svg role="img" aria-labelledby="title"
aria-describedby="desc" width="304" height="290">
<title id="title">Violet pentagram</title>
<desc id="desc">Five pointed star</desc>
<path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z"
style="fill:#b55fff;>
</svg>
<svg width="250" height="100">
<text x="50" y="50" style="fill: #000000; font-size: 2em;">
Tequila
</text>
</svg>
<svg width="250" height="150">
<text x="50" y="25" style="fill: #000000; font-size: 2em;"
transform="rotate(30 20,40)">Tequila</text>
</svg>
Questions?