aria-hidden 的存在是否足够或是否需要将值设置为 "true" (aria-hidden="true")
Is presence of aria-hidden sufficient or is value set to "true" required (aria-hidden="true")
html "hidden" 属性是布尔值,不需要设置值。有存在感就够了
"aria-hidden" 属性呢?光有存在感就够了吗?还是需要设置值"true"?
您必须为 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
aria-hidden
的值必须为 true|false。但是请注意,如果您正在使用 hidden
属性或者如果您正在使用 CSS visibility:none
或display:hidden
。后三种隐藏方式中的所有三种也将从屏幕中隐藏元素 reader。仅当显示器上有您想要从屏幕上隐藏的内容 reader,例如不给页面增添意义的装饰元素时,您才需要 aria-hidden="true"
。
如果您是 "hiding" 对象,通过将其字体大小设置为 0 或使用剪切矩形或 "pushing" 使用 x
或 y
将元素关闭屏幕,那么你将需要在该元素上设置aria-hidden="true"
,因为以前的技术只是在视觉上隐藏元素,而不是真正隐藏元素。
html "hidden" 属性是布尔值,不需要设置值。有存在感就够了
"aria-hidden" 属性呢?光有存在感就够了吗?还是需要设置值"true"?
您必须为 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
aria-hidden
的值必须为 true|false。但是请注意,如果您正在使用 hidden
属性或者如果您正在使用 CSS visibility:none
或display:hidden
。后三种隐藏方式中的所有三种也将从屏幕中隐藏元素 reader。仅当显示器上有您想要从屏幕上隐藏的内容 reader,例如不给页面增添意义的装饰元素时,您才需要 aria-hidden="true"
。
如果您是 "hiding" 对象,通过将其字体大小设置为 0 或使用剪切矩形或 "pushing" 使用 x
或 y
将元素关闭屏幕,那么你将需要在该元素上设置aria-hidden="true"
,因为以前的技术只是在视觉上隐藏元素,而不是真正隐藏元素。