add_setup(async function () {
await new Promise(r => SimpleTest.waitForFocus(r, window));
if (navigator.platform.indexOf("Mac") === 0) {
await SpecialPowers.pushPrefEnv({
set: [["accessibility.tabfocus", 7]],
});
}
});
function promiseMessage(taskfn) {
return new Promise(resolve => {
window.addEventListener("message", resolve, { once: true });
taskfn();
})
}
// Attaches a shadow root containing a cross-origin (OOP) iframe to a fresh
// host appended to #container.
async function createShadowWithOOPIframe() {
let container = document.getElementById("container");
let host = document.createElement("div");
container.appendChild(host);
let sr = host.attachShadow({ mode: "open" });
// Case 1: focus is in a scope owned by Shadow DOM, tab forward into oop iframe.
add_task(async function test_tab_forward_from_shadow_dom_into_oop_iframe() {
let { host, sr } = await createShadowWithOOPIframe();
let shadowBtn = document.createElement("button");
shadowBtn.textContent = "shadow";
sr.insertBefore(shadowBtn, sr.firstChild);
shadowBtn.focus();
is(sr.activeElement, shadowBtn, "shadow button should have focus");
// Case 2: focus is in light tree, tab forward into shadow DOM scope and find
// oop iframe.
add_task(async function test_tab_forward_from_light_dom_into_shadow_oop_iframe() {
const { host } = await createShadowWithOOPIframe();
let beforeBtn = document.getElementById("before");
beforeBtn.focus();
is(document.activeElement, beforeBtn, "before button should have focus");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.