[HTML5] Why ARIA?

For some reason, you build a custom checkbox component, if without ARIA in mind, basiclly this site is unusable for screen reader.

DEMOsite.

In the example, screen reader only read the label of the checkbox, but doesn't tell it is a checkbox and the value of it.

<div tabindex="0" class="checkbox">
Mint slices
</div>

The way to fix it by tell the role is checkbox and set aria-checked to its value:

<div tabindex="0" class="checkbox" tabindex="0" role="checkbox" aria-checked="true">
Tim-Tams
</div>

But really it we can use the native html element, just use the native element.

上一篇:ARIA无障碍技术


下一篇:无障碍开发(六)之ARIA在HTML中的使用规则