Is the css setting speak:none now equivalent to aria-hidden=“true”?

自作多情 提交于 2019-12-06 01:39:00

问题


I'm just wondering whether I should expect browsers and assistive technilogy circa January 2015 to use speak:none in a manner equivalent to setting aria-hidden="true". I'd like to indicate that some semi-opaque text should be ignored, and am wondering whether I can do it in one operation (just adding a class that sets the opaque style and speak:none, rather than adding the class and setting the aria-hidden attribute).


回答1:


There does not seem to be reliable data on support to speak, but it seems to be unimplemented.

Independently of the implementation status, speak: none is not equivalent to aria-hidden="true".

According to the CSS Speech Module CR, the speak property “determines whether or not to render text aurally”, i.e. audibly.

According to the ARIA specification, aria-hidden “indicates that the element and all of its descendants are not visible or perceivable to any user as implemented by the author” (italic in the original).

Thus, aria-hidden="true" does not cause anything; it just declares that the author has hidden the element. And it relates to all kinds of rendering: audible, visible, tactile, or whatever modalities might be invented in the future.




回答2:


To answer the intent of my original question -- I was wondering if I could add a class that sets the opaque style and disables the text from screen readers, rather than add the class and also set the aria-hidden attribute.

What I ended up doing was to set only the aria-hidden attribute, then in my css use [aria-hidden] instead of a class name to set the opaque style.

p[aria-hidden="true"] {
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
  cursor: default;
}
<p aria-hidden="true">Ignore this text!</p>
<p>See this text!</p>


来源:https://stackoverflow.com/questions/27751738/is-the-css-setting-speaknone-now-equivalent-to-aria-hidden-true

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