Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<html>
<head>
<title>Name Comp: Name From Content of a display: contents element</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/wai-aria/scripts/aria-utils.js"></script>
</head>
<body>
<p>Each element below is named from its contents. In the first group its contents are the single character "x", and
text in a following sibling belongs to that sibling and must not be part of the name.</p>
<!-- Each case carries its own following sibling, so no case depends on what the next case happens to be. -->
<div
role="button"
style="display: contents;"
data-expectedlabel="x"
data-testname="name from content of a display: contents element, followed by an inline sibling"
class="ex"
>x</div><span>should not be in the name</span>
<div
role="button"
style="display: contents;"
data-expectedlabel="x"
data-testname="name from content of a display: contents element, followed by a block sibling"
class="ex"
>x</div>
<div>should not be in the name</div>
<div
role="button"
style="display: contents;"
data-expectedlabel="x"
data-testname="name from content of a display: contents element, followed by a text sibling"
class="ex"
>x</div>should not be in the name
<div
role="link"
tabindex="0"
style="display: contents;"
data-expectedlabel="x"
data-testname="name from content of a display: contents element with the link role, followed by a sibling"
class="ex"
>x</div><span>should not be in the name</span>
<p>In the second group the contents are "x" and "y" in different boxes, such as the items of a flex container, and
both are part of the name.</p>
<div><div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element with a block child"
class="ex"
>x <div>y</div></div></div>
<div style="display: flex;"><div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element in a flex container"
class="ex"
>x <span>y</span></div></div>
<div style="display: flex;"><div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element in a flex container, text after an element"
class="ex"
><span>x</span> y</div></div>
<div style="display: flex;"><div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element in a flex container, with a child that does not render"
class="ex"
>x <span style="display: none;">should not be in the name</span><span>y</span></div></div>
<div style="display: flex;"><div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element in a flex container, with a display: contents child"
class="ex"
><span style="display: contents;">x <span>y</span></span></div></div>
<div style="display: grid;"><div
role="link"
tabindex="0"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents element with the link role in a grid container"
class="ex"
>x <span>y</span></div></div>
<p>In the third group the element is a shadow host, so its contents are those of its shadow tree, where a slot stands
for the nodes assigned to it or else its fallback content.</p>
<div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents shadow host, with a node assigned to a slot"
class="ex"
><template shadowrootmode="open">x <slot></slot></template><span>y</span></div>
<div
role="button"
style="display: contents;"
data-expectedlabel="x y"
data-testname="name from content of a display: contents shadow host, with the fallback content of a slot"
class="ex"
><template shadowrootmode="open">x <slot>y</slot></template></div>
<div
role="button"
style="display: contents;"
data-expectedlabel="x"
data-testname="name from content of a display: contents shadow host, with a child that is not assigned to a slot"
class="ex"
><template shadowrootmode="open">x</template><span>should not be in the name</span></div>
<script>
AriaUtils.verifyLabelsBySelector(".ex");
</script>
</body>
</html>