简体   繁体   English

角色=“演示”在H1上

[英]role=“presentation” on H1

Using the following HTML 使用以下HTML

<!DOCTYPE html>
<html>
<head><title>Headings</title></head>
<body>
<main>
    <h1>Heading 1</h1>
    <section>
        <h2>Heading 2</h2>

        <h1 role="presentation">Not Heading 1</h1>
    </section>
</main>
</body>
</html>

ChromeVOX announces "Not Heading 1" as a Heading 1 ChromeVOX宣布“ Not Heading 1”为标题1

validator.w3.org Warns: Warning: Consider using the h1 element as a top-level heading only (all h1 elements are treated as top-level headings by many screen readers and other tools). validateator.w3.org警告:警告:请考虑仅将h1元素用作顶级标题(许多屏幕阅读器和其他工具将所有h1元素都视为顶级标题)。

From what I gather from http://www.w3.org/TR/aria-in-html/#presentation 根据我从http://www.w3.org/TR/aria-in-html/#presentation收集的信息

I thought role="presentation" would remove the semantic value form the h1 element. 我认为role =“ presentation”将删除h1元素的语义值。

Is this the correct expectation from ChromeVox and validator.w3.org? 这是ChromeVox和validator.w3.org的正确预期吗?

For elements with no required children (like h1, h2, etc..), any elements nested inside the element with role=presentation preserve their semantics. 对于没有必需子元素的元素(例如h1,h2等),嵌套在具有role = presentation元素的元素内的任何元素都将保留其语义。

However for elements with required children (such as ul or table) any required child elements nested inside the element with role=presentation also have their semantics removed . 但是,对于具有必需子元素的元素(例如ul或table),嵌套在具有role = presentation元素的所有必需子元素也将删除其语义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM