如何防止Windows讲述人读取隐藏的HTML标签? [英] How to prevent Windows Narrator from reading hidden HTML tags?
问题描述
我有一个HTML页面,其中包含多个隐藏元素,这些元素仅在某些情况下才可见。
I have an HTML page, with multiple hidden elements that become visible only under certain circumstances.
当我将焦点放在页面包装上(以读取所有内容)时,Windows Narrator会读取所有元素,甚至是隐藏的元素。
When I set the focus on the page wrapper (to read all the content), Windows Narrator reads all the elements, even the hidden ones.
我尝试使用aria-hidden = true,CSS显示:无,HTML5隐藏属性,全部都被忽略。到目前为止,我发现起作用的唯一机制是在将焦点放在包装器上之前从DOM中删除此元素。但这不是理想的解决方案。
I have tried using aria-hidden="true", CSS display: none, HTML5 hidden attribute, all are completely ignored. So far, the only mechanism that I found that works is to remove this elements from the DOM, before setting the focus on the wrapper. But it's not an ideal solution.
推荐答案
显然,在MS Edge上这不再是问题!欢呼!如果该元素被CSS display:none隐藏,则它不会读取其内容。
Apparently this isn't an issue anymore on MS Edge! Hurray! If the element is hidden with CSS display:none then it doesn't read it's content.
这篇关于如何防止Windows讲述人读取隐藏的HTML标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!