Bug 1953179 - Fix enter key handling on toolbarbuttons in tab group menu. r=dwalker,tabbrowser-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D245220
This commit is contained in:
Dão Gottwald
2025-04-13 10:34:15 +00:00
parent f2ea56be57
commit a07bd270a0
2 changed files with 12 additions and 2 deletions

View File

@@ -886,7 +886,11 @@
this.close(false);
break;
case KeyEvent.DOM_VK_RETURN:
// When focus is on a toolbarbutton, we need to wait for the command
// event, which will ultimately close the panel as well.
if (event.target.nodeName != "toolbarbutton") {
this.close();
}
break;
}
}

View File

@@ -1830,7 +1830,13 @@ add_task(async function test_tabGroupCreatePanel() {
info("Removing group via delete button");
panelHidden = BrowserTestUtils.waitForPopupEvent(tabgroupPanel, "hidden");
let removePromise = BrowserTestUtils.waitForEvent(group, "TabGroupRemoved");
tabgroupPanel.querySelector("#tabGroupEditor_deleteGroup").click();
let deleteButton = tabgroupPanel.querySelector("#tabGroupEditor_deleteGroup");
if (AppConstants.platform == "macosx") {
deleteButton.click();
} else {
deleteButton.focus();
EventUtils.synthesizeKey("VK_RETURN");
}
await Promise.all([panelHidden, removePromise]);
tabGroupCreatedTrigger.uninit();
});