辅助功能:推荐 SVG 和 MathML 的替代文本约定?

2024-04-30

Overview

HTML5 现在允许 http://dev.w3.org/html5/markup/syntax.html#svg-mathml <svg> and <math>使用 HTML 文档进行标记,而不依赖于外部命名空间(不错的概述here http://www.sanbeiji.com/archives/1243)。两者都有自己的alt- 属性类似物(见下文),当今的屏幕阅读器软件实际上忽略了这些属性。因此,盲人用户无法访问这些元素。

是否计划为这些新元素实施标准的替代文本约定?我已经搜索了文档,但结果却是干巴巴的!

更多细节

关于SVG:SVG 的替代文本可以被视为根的内容title or desc tag.

<svg>
  <title>An image title</title>
  <desc>This is the longer image description</desc>
  ...
</svg>

我发现了one http://www.screenreader.net/屏幕阅读器可以这样读取它,但这是标准吗?以前的方法 http://www.carto.net/papers/svg/samples/svg_html.shtml插入 SVG 也存在可访问性问题,因为<object>屏幕阅读器对标签的处理方式不一致。

关于MathML:MathML 的替代文本应存储在alttext属性 http://www.daisy.org/z3986/structure/SG-DAISY3/part2-math.html#math_examp1e1.

<math alttext="A squared plus B squared equals C squared">
  ...
</math>

由于屏幕阅读器似乎不承认这一点,数学渲染库MathJax http://www.mathjax.org/将文本插入到aria-label运行时的属性。

<span aria-label="[alttext contents]">...</span>

不幸的是,NVDA、JAWS 和其他公司也无法可靠地读取这些标签。 (更多关于WAI-ARIA http://www.w3.org/TR/wai-aria/)

关于两者:由于在很大程度上不受支持的 ARIA 属性方面缺乏成功,我尝试使用title属性。这些“外来”HTML 元素似乎也被忽略了。

Wrap-Up

不仅仅是快速破解,我正在寻找推荐方式在这些新的 HTML 元素上放置替代文本。也许我忽略了 W3C 规范?或者现在还为时过早?


经过一番挖掘,我发现了一些官方的建议。不幸的是,大多数目前还无法运行。在 Math 和 SVG 被认为可以访问之前,浏览器和屏幕阅读器都需要实现很多工作,但是事情are开始抬头。

免责声明:以下建议是我在过去几个月的编码中收集到的。如果有什么问题,请告诉我。随着浏览器和 AT 软件的进步,我会尽力保持最新。

MathML

推荐

Use role="math"连同一个aria-label在周围的div标签(参见docs http://www.w3.org/TR/wai-aria/roles#math)。添加的tabindex="0"允许屏幕阅读器专门关注该元素;这个元素的aria-label可以使用特殊的快捷键(例如NVDA+Tab).

<div role="math" tabindex="0" aria-label="[spoken equivalent]">
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    ...
  </math>
</div>

限制/注意事项

  • 粗略的屏幕阅读器支持aria-label(不太重要的是role="math").
    Update:相关 NVDA 票据aria-label here http://www.nvda-project.org/ticket/1354 and here http://www.nvda-project.org/ticket/1362.
  • 包裹在div or span标签似乎没有必要,因为math is a 一级元素 http://dev.w3.org/html5/html4-differences/#mathml-svg在 HTML5 中。
  • 我发现很少引用 MathMLalttext tag.
    Update:这似乎是一个DAISY http://daisy.org-具体添加,描述here http://www.daisy.org/z3986/structure/SG-DAISY3/part2-math.html.

参考

  • http://www.w3.org/TR/wai-aria/roles#math http://www.w3.org/TR/wai-aria/roles#math
  • http://lists.w3.org/Archives/Public/public-pfwg-comments/2008JanMar/0008.html http://lists.w3.org/Archives/Public/public-pfwg-comments/2008JanMar/0008.html
  • http://www.w3.org/TR/wai-aria-practices/#math http://www.w3.org/TR/wai-aria-practices/#math

SVG

推荐

使用顶级<title> and <desc>标签连同role="img" and aria-label在根 SVG 标签上。

<svg role="img" aria-label="[title + description]">
  <title>[title]</title>
  <desc>[long description]</desc>
  ...
</svg>

限制/注意事项

  • 截至 2011 年 2 月,IE 9 beta 为all <title> and <desc>标签,这可能是不可取的。但是,NVDA、JAWS 和 WindowEyes 将读取aria-label当元素还包含role="img".
  • 如果加载 SVG 文件(即,不是内嵌在 HTML 中),则根级别<title>标签将成为浏览器页面的标题,其中will由屏幕阅读器读取。

参考

  • http://lists.w3.org/Archives/Public/www-svg/2010Oct/0029.html http://lists.w3.org/Archives/Public/www-svg/2010Oct/0029.html
  • http://lists.w3.org/Archives/Public/public-html/2010Jun/0127.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#img
  • http://www.w3.org/TR/wai-aria/roles#namecalculation http://www.w3.org/TR/wai-aria/roles#namecalculation
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

辅助功能:推荐 SVG 和 MathML 的替代文本约定? 的相关文章

随机推荐