ARIA attributes for reading alternative text (e.g. Roman Numerals) in HTML

早过忘川 提交于 2019-12-10 03:34:36

问题


In my HTML document I am using roman numbers (e.g.: MMXV = 2015).

Is there a way to inform screen readers to interpret certain text in another way (e.g.: roman numerals as "Two thousand and fifteen" instead of M-M-X-V)?

My guess was that there would be an ARIA attribute, but I cannot seem to find one. E.g.:

<time datetime="2015" aria-?="Two thousand and fifteen">MMXV</time>

回答1:


Use the aria-label tag to give the element a meaningful description.

Then, hide the roman numerals from screen readers by wrapping them in a span element that has the aria-hidden property set to true to hide the element from screen readers.

<time datetime="2015" aria-label="Two thousand and fifteen">
    <span aria-hidden="true">MMXV</span>
</time>



回答2:


Ok with unobf answer, but you have also to consider that if using aria-label improves accessibility for people using screen readers, it won't increase accessibility for everyone.

You should read point 3.1.4 about abbreviations of the WCAG.

My feeling about this is that roman numbers is a difficult thing to deal with if you really want to be accessible, and not only for blind people. Using an ABBR tag for instance can help people without screenreaders, but ABBR tag aren't focusable element with keyboard (see point 2.1.1) so there isn't an unique problem free solution.



来源:https://stackoverflow.com/questions/28784889/aria-attributes-for-reading-alternative-text-e-g-roman-numerals-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!