зеркало из https://github.com/mozilla/gecko-dev.git
567 строки
22 KiB
HTML
567 строки
22 KiB
HTML
<html>
|
|
<head>
|
|
<title>Test for Bug 1453693</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script>
|
|
|
|
var lastFocusTarget;
|
|
function focusLogger(event) {
|
|
lastFocusTarget = event.target;
|
|
console.log(event.target + " under " + event.target.parentNode);
|
|
event.stopPropagation();
|
|
}
|
|
|
|
function testTabbingThroughShadowDOMWithTabIndexes() {
|
|
var anchor = document.createElement("a");
|
|
anchor.onfocus = focusLogger;
|
|
anchor.href = "#";
|
|
anchor.textContent = "in light DOM";
|
|
document.body.appendChild(anchor);
|
|
|
|
var host = document.createElement("div");
|
|
document.body.appendChild(host);
|
|
|
|
var sr = host.attachShadow({mode: "open"});
|
|
var shadowAnchor = anchor.cloneNode(false);
|
|
shadowAnchor.onfocus = focusLogger;
|
|
shadowAnchor.textContent = "in shadow DOM";
|
|
sr.appendChild(shadowAnchor);
|
|
var shadowInput = document.createElement("input");
|
|
shadowInput.onfocus = focusLogger;
|
|
shadowInput.tabIndex = 1;
|
|
sr.appendChild(shadowInput);
|
|
|
|
var shadowDate = document.createElement("input");
|
|
shadowDate.type = "date";
|
|
shadowDate.onfocus = focusLogger;
|
|
shadowDate.tabIndex = 1;
|
|
sr.appendChild(shadowDate);
|
|
|
|
var shadowIframe = document.createElement("iframe");
|
|
shadowIframe.tabIndex = 1;
|
|
sr.appendChild(shadowIframe);
|
|
shadowIframe.contentDocument.body.innerHTML = "<input>";
|
|
|
|
var input = document.createElement("input");
|
|
input.onfocus = focusLogger;
|
|
input.tabIndex = 1;
|
|
document.body.appendChild(input);
|
|
|
|
var input2 = document.createElement("input");
|
|
input2.onfocus = focusLogger;
|
|
document.body.appendChild(input2);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input, "Should have focused input element. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, anchor, "Should have focused anchor element. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(shadowIframe.contentDocument.activeElement,
|
|
shadowIframe.contentDocument.documentElement,
|
|
"Should have focused document element in shadow iframe. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(shadowIframe.contentDocument.activeElement,
|
|
shadowIframe.contentDocument.body.firstChild,
|
|
"Should have focused input element in shadow iframe. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM. (3)");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input2, "Should have focused input[2] element. (3)");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(shadowIframe.contentDocument.activeElement,
|
|
shadowIframe.contentDocument.body.firstChild,
|
|
"Should have focused input element in shadow iframe. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(shadowIframe.contentDocument.activeElement,
|
|
shadowIframe.contentDocument.documentElement,
|
|
"Should have focused document element in shadow iframe. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, anchor, "Should have focused anchor element. (4)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input, "Should have focused input element. (4)");
|
|
|
|
document.body.innerHTML = null;
|
|
}
|
|
|
|
function testTabbingThroughSimpleShadowDOM() {
|
|
var anchor = document.createElement("a");
|
|
anchor.onfocus = focusLogger;
|
|
anchor.href = "#";
|
|
anchor.textContent = "in light DOM";
|
|
document.body.appendChild(anchor);
|
|
anchor.focus();
|
|
|
|
var host = document.createElement("div");
|
|
document.body.appendChild(host);
|
|
|
|
var sr = host.attachShadow({mode: "open"});
|
|
var shadowAnchor = anchor.cloneNode(false);
|
|
shadowAnchor.onfocus = focusLogger;
|
|
shadowAnchor.textContent = "in shadow DOM";
|
|
sr.appendChild(shadowAnchor);
|
|
var shadowInput = document.createElement("input");
|
|
shadowInput.onfocus = focusLogger;
|
|
sr.appendChild(shadowInput);
|
|
|
|
var hiddenShadowButton = document.createElement("button");
|
|
hiddenShadowButton.setAttribute("style", "display: none;");
|
|
sr.appendChild(hiddenShadowButton);
|
|
|
|
var input = document.createElement("input");
|
|
input.onfocus = focusLogger;
|
|
document.body.appendChild(input);
|
|
|
|
var input2 = document.createElement("input");
|
|
input2.onfocus = focusLogger;
|
|
document.body.appendChild(input2);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM.");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM.");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input, "Should have focused input element.");
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input2, "Should have focused input[2] element.");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input, "Should have focused input element. (2)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM. (2)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM. (2)");
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, anchor, "Should have focused anchor element. (2)");
|
|
|
|
host.remove();
|
|
input.remove();
|
|
input2.remove();
|
|
}
|
|
|
|
function testTabbingThroughNestedShadowDOM() {
|
|
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus. (1)");
|
|
|
|
var host = document.createElement("div");
|
|
host.id = "host";
|
|
document.body.appendChild(host);
|
|
|
|
var sr0 = host.attachShadow({mode: "open"});
|
|
sr0.innerHTML = "<button id='button'>X</button><br id='br'><div id='h1'></div><div id='h2'></div>";
|
|
var button = sr0.getElementById("button");
|
|
button.onfocus = focusLogger;
|
|
|
|
var h1 = sr0.getElementById("h1");
|
|
var sr1 = h1.attachShadow({mode: "open"});
|
|
sr1.innerHTML = "h1 <input id='h11' placeholder='click me and press tab'><input id='h12' placeholder='and then tab again'>";
|
|
var input11 = sr1.getElementById("h11");
|
|
input11.onfocus = focusLogger;
|
|
var input12 = sr1.getElementById("h12");
|
|
input12.onfocus = focusLogger;
|
|
|
|
var h2 = sr0.getElementById("h2");
|
|
var sr2 = h2.attachShadow({mode: "open"});
|
|
sr2.innerHTML = "h2 <input id='h21'><input id='h22'>";
|
|
var input21 = sr2.getElementById("h21");
|
|
input21.onfocus = focusLogger;
|
|
var input22 = sr2.getElementById("h22");
|
|
input22.onfocus = focusLogger;
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, button, "[nested shadow] Should have focused button element. (1)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input11, "[nested shadow] Should have focused input element. (1)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input12, "[nested shadow] Should have focused input element. (2)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input21, "[nested shadow] Should have focused input element. (3)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input22, "[nested shadow] Should have focused input element. (4)");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input21, "[nested shadow] Should have focused input element. (5)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input12, "[nested shadow] Should have focused input element. (6)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input11, "[nested shadow] Should have focused input element. (7)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, button, "[nested shadow] Should have focused button element. (8)");
|
|
|
|
// Back to beginning, outside of Shadow DOM.
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus. (2)");
|
|
|
|
host.remove();
|
|
}
|
|
|
|
function testTabbingThroughDisplayContentsHost() {
|
|
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus. (1)");
|
|
|
|
var host = document.createElement("div");
|
|
host.id = "host";
|
|
host.setAttribute("style", "display: contents; border: 1px solid black;");
|
|
document.body.appendChild(host);
|
|
|
|
var sr0 = host.attachShadow({mode: "open"});
|
|
sr0.innerHTML = "<input id='shadowInput1'><input id='shadowInput2'>";
|
|
var shadowInput1 = sr0.getElementById("shadowInput1");
|
|
shadowInput1.onfocus = focusLogger;
|
|
var shadowInput2 = sr0.getElementById("shadowInput2");
|
|
shadowInput2.onfocus = focusLogger;
|
|
|
|
var host1 = document.createElement("div");
|
|
host1.id = "host";
|
|
host1.tabIndex = 0;
|
|
host1.setAttribute("style", "display: contents; border: 1px solid black;");
|
|
document.body.appendChild(host1);
|
|
|
|
var sr1 = host1.attachShadow({mode: "open"});
|
|
sr1.innerHTML = "<input id='shadowInput1'><input id='shadowInput2'>";
|
|
var shadowInput3 = sr1.getElementById("shadowInput1");
|
|
shadowInput3.onfocus = focusLogger;
|
|
var shadowInput4 = sr1.getElementById("shadowInput2");
|
|
shadowInput4.onfocus = focusLogger;
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput1, "Should have focused input element. (1)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput2, "Should have focused input element. (2)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput3, "Should have focused input element. (3)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput4, "Should have focused input element. (4)");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput3, "Should have focused input element. (5)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput2, "Should have focused input element. (6)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput1, "Should have focused input element. (7)");
|
|
|
|
// Back to beginning, outside of Shadow DOM.
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus. (2)");
|
|
|
|
host.remove();
|
|
host1.remove();
|
|
}
|
|
|
|
function testTabbingThroughLightDOMShadowDOMLightDOM() {
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
var host = document.createElement("span");
|
|
host.innerHTML = "\n";
|
|
host.id = "host";
|
|
document.body.appendChild(host);
|
|
|
|
var sr0 = host.attachShadow({mode: "open"});
|
|
sr0.innerHTML = document.getElementById("template").innerHTML;
|
|
var p1 = sr0.getElementById("p1");
|
|
p1.onfocus = focusLogger;
|
|
var p2 = sr0.getElementById("p2");
|
|
p2.onfocus = focusLogger;
|
|
|
|
var p = document.createElement("p");
|
|
p.innerHTML = " <a href='#p'>link 1</a> ";
|
|
var a = p.firstElementChild;
|
|
a.onfocus = focusLogger;
|
|
document.body.appendChild(p);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, p1, "Should have focused p1.");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, p2, "Should have focused p2.");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, a, "Should have focused a.");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, p2, "Should have focused p2.");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, p1, "Should have focused p1.");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
host.remove();
|
|
p.remove();
|
|
}
|
|
|
|
function testFocusableHost() {
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
var host = document.createElement("div");
|
|
host.id = "host";
|
|
host.tabIndex = 0;
|
|
host.onfocus = focusLogger;
|
|
document.body.appendChild(host);
|
|
|
|
var slotted = document.createElement("div");
|
|
slotted.tabIndex = 0;
|
|
slotted.onfocus = focusLogger;
|
|
host.appendChild(slotted);
|
|
|
|
var sr0 = host.attachShadow({mode: "open"});
|
|
sr0.appendChild(document.createElement("slot"));
|
|
|
|
var p = document.createElement("p");
|
|
p.innerHTML = " <a href='#p'>link 1</a> ";
|
|
var a = p.firstElementChild;
|
|
a.onfocus = focusLogger;
|
|
document.body.appendChild(p);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, host, "Should have focused host.");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, slotted, "Should have focused slotted.");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, a, "Should have focused a.");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, slotted, "Should have focused slotted.");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, host, "Should have focused host.");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
host.remove();
|
|
p.remove();
|
|
}
|
|
|
|
function testShiftTabbingThroughFocusableHost() {
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
var host = document.createElement("div");
|
|
host.id = "host";
|
|
host.tabIndex = 0;
|
|
host.onfocus = focusLogger;
|
|
document.body.appendChild(host);
|
|
|
|
var sr = host.attachShadow({mode: "open"});
|
|
var shadowButton = document.createElement("button");
|
|
shadowButton.innerText = "X";
|
|
shadowButton.onfocus = focusLogger;
|
|
sr.appendChild(shadowButton);
|
|
|
|
var shadowInput = document.createElement("input");
|
|
shadowInput.onfocus = focusLogger;
|
|
sr.appendChild(shadowInput);
|
|
sr.appendChild(document.createElement("br"));
|
|
|
|
var input = document.createElement("input");
|
|
input.onfocus = focusLogger;
|
|
document.body.appendChild(input);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, host, "Should have focused host element. (1)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowButton, "Should have focused button element in shadow DOM. (2)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM. (3)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input, "Should have focused input element. (4)");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowInput, "Should have focused input element in shadow DOM. (5)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, shadowButton, "Should have focused button element in shadow DOM. (6)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
// focus is already on host
|
|
opener.is(sr.activeElement, null,
|
|
"Focus should have left button element in shadow DOM. (7)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
host.remove();
|
|
input.remove();
|
|
}
|
|
|
|
function testTabbingThroughNestedSlot() {
|
|
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus.");
|
|
|
|
var host0 = document.createElement("div");
|
|
var sr0 = host0.attachShadow({mode: "open"});
|
|
sr0.innerHTML = "<slot></slot>";
|
|
document.body.appendChild(host0);
|
|
|
|
// focusable
|
|
var host00 = document.createElement("div");
|
|
var sr00 = host00.attachShadow({mode: "open"});
|
|
var div00 = document.createElement("div");
|
|
div00.tabIndex = 0;
|
|
div00.onfocus = focusLogger;
|
|
sr00.appendChild(div00);
|
|
host0.appendChild(host00);
|
|
|
|
// not focusable
|
|
var host01 = document.createElement("div");
|
|
var sr01 = host01.attachShadow({mode: "open"});
|
|
sr01.innerHTML = "<div></div>";
|
|
host0.appendChild(host01);
|
|
|
|
// focusable
|
|
var host02 = document.createElement("div");
|
|
var sr02 = host02.attachShadow({mode: "open"});
|
|
var div02 = document.createElement("div");
|
|
div02.tabIndex = 0;
|
|
div02.onfocus = focusLogger;
|
|
sr02.appendChild(div02);
|
|
host0.appendChild(host02);
|
|
|
|
var host1 = document.createElement("div");
|
|
var sr1 = host1.attachShadow({mode: "open"});
|
|
sr1.innerHTML = "<slot></slot>";
|
|
document.body.appendChild(host1);
|
|
|
|
var host10 = document.createElement("div");
|
|
var sr10 = host10.attachShadow({mode: "open"});
|
|
sr10.innerHTML = "<slot></slot>";
|
|
host1.appendChild(host10);
|
|
|
|
var input10 = document.createElement("input");
|
|
input10.onfocus = focusLogger;
|
|
host10.appendChild(input10);
|
|
|
|
var host11 = document.createElement("div");
|
|
var sr11 = host11.attachShadow({mode: "open"});
|
|
sr11.innerHTML = "<slot></slot>";
|
|
host1.appendChild(host11);
|
|
|
|
var input11 = document.createElement("input");
|
|
input11.onfocus = focusLogger;
|
|
host11.appendChild(input11);
|
|
|
|
document.body.offsetLeft;
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, div00, "Should have focused div element in shadow DOM. (1)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, div02, "Should have focused div element in shadow DOM. (2)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input10, "Should have focused input element in shadow DOM. (3)");
|
|
|
|
synthesizeKey("KEY_Tab");
|
|
opener.is(lastFocusTarget, input11, "Should have focused button element in shadow DOM. (4)");
|
|
|
|
// Backwards
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, input10, "Should have focused input element in shadow DOM. (5)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, div02, "Should have focused input element in shadow DOM. (6)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(lastFocusTarget, div00, "Should have focused input element in shadow DOM. (7)");
|
|
|
|
synthesizeKey("KEY_Tab", {shiftKey: true});
|
|
opener.is(document.activeElement, document.body.firstChild,
|
|
"body's first child should have focus.");
|
|
|
|
host0.remove();
|
|
host1.remove();
|
|
}
|
|
|
|
function runTest() {
|
|
|
|
testTabbingThroughShadowDOMWithTabIndexes();
|
|
testTabbingThroughSimpleShadowDOM();
|
|
testTabbingThroughNestedShadowDOM();
|
|
testTabbingThroughDisplayContentsHost();
|
|
testTabbingThroughLightDOMShadowDOMLightDOM();
|
|
testFocusableHost();
|
|
testShiftTabbingThroughFocusableHost();
|
|
testTabbingThroughNestedSlot();
|
|
|
|
opener.didRunTests();
|
|
window.close();
|
|
}
|
|
|
|
function init() {
|
|
SimpleTest.waitForFocus(runTest);
|
|
}
|
|
</script>
|
|
<style>
|
|
</style>
|
|
<template id="template">
|
|
<div style="overflow: hidden">
|
|
<p tabindex="0" id="p1">component</p>
|
|
<p tabindex="0" id="p2">/component</p>
|
|
</div>
|
|
</template>
|
|
</head>
|
|
<body onload="init()">
|
|
</body>
|
|
</html>
|