Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/interact/focus-inside-hidden-svg-containers-04.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Non-rendered SVG containers cannot receive focus</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<defs id="defs" tabindex="0"></defs>
<symbol id="symbol" tabindex="0"></symbol>
<clipPath id="clipPath" tabindex="0"></clipPath>
<mask id="mask" tabindex="0"></mask>
<marker id="marker" tabindex="0"></marker>
<pattern id="pattern" tabindex="0"></pattern>
<linearGradient id="linearGradient" tabindex="0"></linearGradient>
<radialGradient id="radialGradient" tabindex="0"></radialGradient>
</svg>
<script>
for (const id of ["defs", "symbol", "clipPath", "mask", "marker", "pattern", "linearGradient", "radialGradient"]) {
test(() => {
const element = document.getElementById(id);
element.focus();
assert_not_equals(document.activeElement, element, `<${element.localName} tabindex="0"> should not be focusable`);
}, `Non-rendered <${id}> is not focusable`);
}
</script>