辅助功能:推荐用于 SVG 和 MathML 的替代文本约定? [英] Accessibility: recommended alt-text convention for SVG and MathML?
问题描述
概述
HTML5 现在允许 和
带有 HTML 文档的标记,不依赖于外部命名空间(体面的概述 此处).两者都有自己的
alt
属性类似物(见下文),如今的屏幕阅读器软件有效地忽略了这些类似物.因此,盲人用户无法访问这些元素.
是否有计划为这些新元素实施标准的替代文本约定?我已经搜索了文档并且已经干了!
更多详情
关于 SVG: SVG 的替代文本可以被视为根 title
或 desc
标签的内容.
我找到了 one 屏幕阅读器,它可以这样读取,但这是标准吗?以前的方法插入SVG也有可访问性问题,因为 标签被屏幕阅读器处理不一致.
关于 MathML: MathML 的替代文本应存储在 alttext
属性.
由于屏幕阅读器似乎不承认这一点,数学渲染库MathJax 将文本插入<运行时的 code>aria-label 属性.
<span aria-label="[alttext contents]">...</span>
不幸的是,NVDA、JAWS 和其他公司也不能可靠地读取这些标签.(更多关于 WAI-ARIA)
关于两者:在很大程度上不受支持的 ARIA 属性方面缺乏成功,我尝试使用 title
属性.在这些外来"HTML 元素上,这些似乎也被忽略了.
总结
我正在寻找一种推荐的方法来在这些新的 HTML 元素上放置替代文本,这不仅仅是一个快速的技巧.也许我忽略了 W3C 规范?还是现在还为时过早?
经过一番挖掘,我找到了一些官方建议.不幸的是,大多数在这个时间点都不起作用.在 Math 和 SVG 被视为可访问之前,浏览器和屏幕阅读器都有很多需要实现,但事情正在开始查找.
免责声明:以下建议是我在过去几个月的编码过程中收集到的.如果有什么不对劲,请告诉我.随着浏览器和 AT 软件的发展,我会尽量保持最新.
数学语言
推荐
在周围的 div
标签上使用 role="math"
和 aria-label
(参见 文档).tabindex="0"
的添加允许屏幕阅读器专门关注这个元素;此元素的 aria-label
可以使用特殊的快捷键(例如 NVDA+Tab
)朗读.
<div role="math" tabindex="0" aria-label="[口语等效项]"><math xmlns="http://www.w3.org/1998/Math/MathML">...</数学>
限制/注意事项
- 对
aria-label
的粗略屏幕阅读器支持(不太重要的是role="math"
).
更新: 相关关于aria-label
的 NVDA 门票 此处 和 这里. - 包装在
div
或span
标签中似乎没有必要,因为math
是一个 HTML5 中的一流元素. - 我发现很少引用 MathML
alttext
标签.
更新:这似乎是一个 DAISY 特定添加,描述 这里.
参考资料
- http://www.w3.org/TR/wai-aria/角色#math
- http://lists.w3.org/档案/公共/public-pfwg-comments/2008JanMar/0008.html
- http://www.w3.org/TR/wai-aria-实践/#math
SVG
推荐
使用顶级
和
标签以及 role="img"
和 aria-label
在根 SVG 标签上.
限制/注意事项
- 截至 2011 年 2 月,IE 9 测试版读取所有
和
标签,这可能是不可取的.但是,当元素还包含role="img"
时,NVDA、JAWS 和 WindowEyes 将读取aria-label
. - 如果加载一个 SVG 文件(也就是说,不是内嵌在 HTML 中),根级
标签将成为浏览器页面的标题,将由屏幕阅读器阅读.
参考资料
- http://lists.w3.org/Archives/public/www-svg/2010Oct/0029.html
- http://lists.w3.org/Archives/public/public-html/2010Jun/0127.html
- http://www.w3.org/TR/wai-aria/角色#img
- http://www.w3.org/TR/wai-aria/角色#namecalculation
Overview
HTML5 now allows <svg>
and <math>
markup with an HTML document without depending on external namespaces (decent overview here). Both have their own alt
-attribute analogs (see below) which are effectively ignored by today's screen-reader software. Thus, these elements are inaccessible to blind users.
Are there plans to implement a standard alt-text convention for these new elements? I've scoured the docs and have come up dry!
Futher Details
Regarding SVG: an SVG's alternate text could be considered the contents of the root title
or desc
tag.
<svg>
<title>An image title</title>
<desc>This is the longer image description</desc>
...
</svg>
I've found one screen-reader which reads it as such, but is this standard? Previous methods of inserting SVG also had accessibility issues since <object>
tags are treatedly inconsistently by screen-readers.
Regarding MathML: MathML's alternate text should be stored in the alttext
attribute.
<math alttext="A squared plus B squared equals C squared">
...
</math>
Since screen readers do not seem to acknowledge this, the math-rendering library MathJax inserts text into an aria-label
attribute at run-time.
<span aria-label="[alttext contents]">...</span>
Unfortunately NVDA, JAWS, and others do not reliably read these labels yet either. (More on WAI-ARIA)
Regarding both: lacking success with the largely-unsupported ARIA attributes, I tried using title
attributes. These also seem to be ignored on these "foreign" HTML elements.
Wrap-Up
More than a quick hack, I'm looking for the recommended way to place alternate-text on these new HTML elements. Perhaps there is a W3C spec I'm overlooking? Or is it still just too early in the game?
After some digging, I found some somewhat official recommendations. Unfortunately, most are not functional at this point in time. Both the browsers and the screen readers have a lot of to implement before Math and SVG can be considered accessible, but things are starting to look up.
Disclaimer: the below recommendations are what I have gleaned over the past few months of coding. If something is dead wrong, please let me know. I will try to keep this up to date as browsers and AT software progresses.
MathML
Recommendation
Use role="math"
along with an aria-label
on a surrounding div
tag (see docs). The addition of tabindex="0"
allows screen readers to focus specifically on this element; this element's aria-label
can be spoken using a special key shortcut (such as NVDA+Tab
).
<div role="math" tabindex="0" aria-label="[spoken equivalent]">
<math xmlns="http://www.w3.org/1998/Math/MathML">
...
</math>
</div>
Limitations/Considerations
- Sketchy screen reader support on
aria-label
(and less importantlyrole="math"
).
Update: Relevant NVDA tickets regardingaria-label
here and here. - Wrapping in
div
orspan
tag seems unnecessary sincemath
is a first-class element in HTML5. - I found very little referencing the MathML
alttext
tag.
Update: this appears to be a DAISY-specific addition, described here.
References
- http://www.w3.org/TR/wai-aria/roles#math
- http://lists.w3.org/Archives/Public/public-pfwg-comments/2008JanMar/0008.html
- http://www.w3.org/TR/wai-aria-practices/#math
SVG
Recommendation
Use top-level <title>
and <desc>
tags together with role="img"
and aria-label
on the root SVG tag.
<svg role="img" aria-label="[title + description]">
<title>[title]</title>
<desc>[long description]</desc>
...
</svg>
Limitations/Considerations
- As of February 2011, IE 9 beta reads all
<title>
and<desc>
tags, which is probably undesirable. However, NVDA, JAWS, and WindowEyes will read thearia-label
when the element also containsrole="img"
. - If loading an SVG file (that is, not inline in HTML), the root-level
<title>
tag will become the browser page's title, which will be read by the screen reader.
References
- http://lists.w3.org/Archives/Public/www-svg/2010Oct/0029.html
- http://lists.w3.org/Archives/Public/public-html/2010Jun/0127.html
- http://www.w3.org/TR/wai-aria/roles#img
- http://www.w3.org/TR/wai-aria/roles#namecalculation
这篇关于辅助功能:推荐用于 SVG 和 MathML 的替代文本约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!