<!doctypehtml>
<title>Test for bug 1795509 - overflow:hidden elements should not be focusable via Tab</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async function() {
if (navigator.platform.indexOf("Mac") === 0) {
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
}
const cases = [
// [id, description, expectedFocusable]
// overflow-x:hidden, content overflows only in X -> not focusable
["x-hidden-x-overflow", "overflow-x:hidden with X overflow only", false],
// overflow-y:hidden, content overflows only in Y -> not focusable
["y-hidden-y-overflow", "overflow-y:hidden with Y overflow only", false],
// overflow-x:hidden, content overflows only in Y -> focusable
["x-hidden-y-overflow", "overflow-x:hidden with Y overflow only", true],
// overflow-y:hidden, content overflows only in X -> focusable
["y-hidden-x-overflow", "overflow-y:hidden with X overflow only", true],
// both hidden -> not focusable
["both-hidden", "overflow:hidden in both directions", false],
// both auto, content overflows -> focusable
["both-auto-overflow", "overflow:auto in both directions with overflow", true],
// both auto, no overflow -> not focusable
["both-auto-no-overflow", "overflow:auto in both directions without overflow", false],
];
for (let [id, description, expectedFocusable] of cases) {
const caseStart = document.querySelector(`input[data-for="${id}"]`);
caseStart.focus();
is(document.activeElement, caseStart, `Sanity: focus on start before testing "${description}"`);
synthesizeKey("KEY_Tab");
const el = document.getElementById(id);
if (expectedFocusable) {
is(document.activeElement, el, `"${description}" should be focusable via Tab`);
} else {
isnot(document.activeElement, el, `"${description}" should NOT be focusable via Tab`);
}
}
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.