- From: Richard Schwerdtfeger <richschwer@gmail.com>
- Date: Thu, 1 Sep 2016 08:28:42 -0500
- To: Tzviya - Hoboken Siegman <tsiegman@wiley.com>, Janina Sajka <janina@rednote.net>
- Cc: "DPUB-ARIA (public-dpub-aria@w3.org)" <public-dpub-aria@w3.org>
User context information can be accessed via the media queries API and User Settings. Both technologies provide a vehicle to be notified when either a Media Query information you are looking for changes or the the User Settings changes.
Indie UI user settings will also reflect Media Query information in key/value pairs.
To add an Indie UI user setting listenter simply to the following:
To listen for a key value to change in user settings doe the following:
window.addSettingListener('audio-description', handleAudioDescriptionChanged);
and the handler would look something like the following:
// Author defines a function to handle changes of the audioDescription setting.
function handleAudioDescriptionChanged(key, value) {
if (key === 'audio-description' && value !=== 'none') {
// User has shared that audio descriptions should be presented.
// Enable the "descriptive audio" track in the video.
} else {
// Set to default. Audio descriptions are off,
// or the user has chosen to not share this setting.
// Authors should still provide a way to enable the
// audio description track in the video player interface.
}
}
To add a Media Query listener simply.
do the following:
var mql = window.matchMedia("screen and (screenreader)");
mql.addListener(function(mql) {
console.log("Changed!");
});
Indie UI User Context will definitely be implemented in WebKit, Chrome, and FF. I have not checked on Microsoft yet and I don't have timelines for the other browsers at this time.
Rich
Rich Schwerdtfeger
Received on Thursday, 1 September 2016 13:29:13 UTC