Bug 1883524 - Port bug 1483828: Inconsistent focus behaviour of iframes. r=aleca

Differential Revision: https://phabricator.services.mozilla.com/D203542

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Lankow 2024-03-05 01:54:46 +00:00
Родитель 62d0259689
Коммит 6008ca553d
3 изменённых файлов: 36 добавлений и 21 удалений

Просмотреть файл

@ -2893,8 +2893,8 @@ var detailsPane = {
}
// Remove these elements from (or add them back to) the tab focus cycle.
for (const id of ["books", "searchInput", "displayButton", "cardsBody"]) {
document.getElementById(id).tabIndex = editing ? -1 : 0;
for (const id of ["booksPane", "cardsPane"]) {
document.getElementById(id).inert = editing;
}
if (editing) {

Просмотреть файл

@ -868,26 +868,42 @@ add_task(async function test_basic_edit() {
// Check that pressing Tab can't get us stuck on an element that shouldn't
// have focus.
abDocument.documentElement.focus();
const firstNameField = abDocument.getElementById("vcard-n-firstname");
Assert.equal(
document.activeElement,
abWindow.browsingContext.topFrameElement,
"address book frame should have focus"
);
Assert.equal(
abDocument.activeElement,
abDocument.documentElement,
"focus should be on the root element"
);
EventUtils.synthesizeKey("VK_TAB", {}, abWindow);
Assert.ok(
abDocument
.getElementById("editContactForm")
.contains(abDocument.activeElement),
"focus should be on the editing form"
);
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true }, abWindow);
Assert.equal(
abDocument.activeElement,
abDocument.documentElement,
"focus should be on the root element again"
firstNameField,
"first name field should be focused"
);
for (let loops = 0; loops < 100; loops++) {
EventUtils.synthesizeKey("VK_TAB", {}, abWindow);
if (!abDocument.activeElement.closest("#detailsPane")) {
Assert.report(
true,
undefined,
undefined,
"focus escaped the details pane!"
);
break;
}
if (abDocument.activeElement == firstNameField) {
break;
}
}
if (abDocument.activeElement != firstNameField) {
Assert.report(
true,
undefined,
undefined,
"focus cycle never returned to the first name field"
);
}
// Check that clicking outside the form doesn't steal focus.
EventUtils.synthesizeMouseAtCenter(booksList, {}, abWindow);

Просмотреть файл

@ -412,9 +412,8 @@ add_task(async function roving_multi_message_buttons() {
);
const headerButtons = headerToolbar.querySelectorAll(BUTTONS_SELECTOR);
// Press tab twice while on the message selected to access the multi message
// view header buttons.
EventUtils.synthesizeKey("KEY_Tab", {});
// Press tab while on the message selected to access the multi message view
// header buttons.
EventUtils.synthesizeKey("KEY_Tab", {});
Assert.equal(
headerButtons[0].id,