Is presence of aria-hidden sufficient or is value set to “true” required (aria-hidden=“true”)

吃可爱长大的小学妹 提交于 2019-12-20 03:07:07

问题


The html "hidden" attribute is a boolean and does NOT need a value set. It's mere presence is sufficient.

What about the "aria-hidden" attribute? Is it's mere presence sufficient? Or does it require the value "true" to be set?


回答1:


aria-hidden must have a value of true|false. Note, however, that aria-hidden is not needed if you are using the hidden attribute or if you are using CSS visibility:none or display:hidden. All three of these latter three ways to hide will also hide the element from a screen reader. You only need aria-hidden="true" if there's something on the display that you want to hide from a screen reader, such as a decorative element that does not add meaning to the page.

If you are "hiding" an object by setting its font size to 0 or using a clipping rectangle or "pushing" the element off the screen with x or y, then you will need to set aria-hidden="true" on that element because the former techniques are only visually hiding the element and not truly hiding the element.




回答2:


You must supply a value for aria-hidden.

"If an element is only visible after some user action, authors MUST set the aria-hidden attribute to true. When the element is presented, authors MUST set the aria-hidden attribute to false or remove the attribute, indicating that the element is visible."

https://www.w3.org/WAI/PF/aria/states_and_properties#aria-hidden



来源:https://stackoverflow.com/questions/51255045/is-presence-of-aria-hidden-sufficient-or-is-value-set-to-true-required-aria-h

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