23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If you play with the sample, you’ll notice that when you tab to the chat window, Narrator reads the<br />

entire contents. When you enter a line of in the single line control, on the other hand, Narrator only<br />

reads the new element that’s been added. This is due to a default value of false for the aria-atomic<br />

attribute (not present in the markup). When used on an aria-live element, this tells the screen reader<br />

to read only the changed node in that element. If you set aria-atomic to true, a change to any child<br />

element is considered a change to the whole element such that all the contents will be read. This can<br />

apply on multiple levels, mind you, so that if you add a child element that is atomic and add grandchild<br />

elements within it, only that atomic child element would be read if the parent element is not atomic.<br />

As for the markup in pages/table/table.html, this gives us an example of aria-describedby. Here’s<br />

the relevant section, omitting the table contents:<br />

<br />

Sample table<br />

This table shows sample data.<br />

...<br />

<br />

<br />

<br />

<br />

When you set the focus to the table in the running sample (you have to use the mouse for this unless<br />

you add a tabindex to the table), you’ll initially hear “Sample table” according to the aria-labelledby<br />

attribute. Then press Win+Alt+F, and you’ll hear “Item described by…” followed by the<br />

aria-describedby text. (And yes, go ahead and change it so that Narrator says some silly things. You<br />

know you want to!)<br />

Note, finally, that it’s essential that the title and subtitle elements also have some aria-related<br />

attributes, such as role. Otherwise aria-labelledby and aria-describedby won’t work.<br />

Handling Contrast Variations<br />

Working with high contrast modes is primarily one of accommodating changes to the Windows color<br />

theme and making sure that you apply graphics that meet high contrast requirements. Technically<br />

speaking, high contrast is defined by the W3C as a minimum luminosity ratio of 4.5 to 1. A full<br />

explanation including how to measure this ratio can be found on<br />

http://www.w3.org/TR/WCAG20-TECHS/G18.html. A Contrast Analyzer (from the Paciello Group) is also<br />

available to check your images (some of mine in Here My Am! failed the test). Do note, however, that<br />

creating high contrast graphics isn’t required for non-informational content such as logos and<br />

decorative graphics. At the same time, full-color graphics might look out of place in a high contrast<br />

mode, so be sure to evaluate your entire end-to-end user experience under such conditions.<br />

An app handles high contrast through four means. The first is to use built-in controls (both <strong>HTML</strong><br />

and WinJS) and let the system do the work! To see what happens, run a few of the controls samples,<br />

such as the <strong>HTML</strong> essential controls sample and <strong>HTML</strong> essential controls sample and the <strong>HTML</strong> Rating<br />

788

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!