Data-title/data-original-title attributes and accessibility

风格不统一 提交于 2019-12-23 17:58:40

问题


I have been searching for information about the attributes data-title and data-original-title. My issue is that Twitter Bootstrap converts the title-attribute into a data-original-title and I am not sure that this is what I want. What about screen readers for instance? Do they treat the data-title as a title, or do they ignore it? If I use one of those data-attributes, do I have to add a title-attribute as well?


回答1:


The custom data-* attributes are defined for HTML5. They are "intended to store custom data private to the page or application".

The spec says:

These attributes are not intended for use by software that is independent of the site that uses the attributes.

So other tools (like screen readers) should not make use of them.

If something is a title, you should not use a data-* attribute (like data-title) in the first place, as the spec says "[…] for which there are no more appropriate attributes or elements"; use title.



来源:https://stackoverflow.com/questions/25631604/data-title-data-original-title-attributes-and-accessibility

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