Bug 1966979 - Set type=checkbox properly on genai menuitems. r=firefox-ai-ml-reviewers,Mardak

On Linux (and maybe macOS) this has always been broken.

Differential Revision: https://phabricator.services.mozilla.com/D249850
This commit is contained in:
Emilio Cobos Álvarez
2025-05-17 06:33:10 +00:00
committed by ealvarez@mozilla.com
parent d1f59b18d4
commit b9b4aa5db3

View File

@@ -287,15 +287,19 @@ function renderMore() {
],
].forEach(([type, l10n, command, checked]) => {
const item = menu.appendChild(topDoc.createXULElement(type));
if (type == "menuitem") {
document.l10n.setAttributes(item, ...l10n);
item.addEventListener("command", () => {
command();
Glean.genaiChatbot.sidebarMoreMenuClick.record({
action: command.name,
provider: providerId,
});
if (type != "menuitem") {
return;
}
document.l10n.setAttributes(item, ...l10n);
item.addEventListener("command", () => {
command();
Glean.genaiChatbot.sidebarMoreMenuClick.record({
action: command.name,
provider: providerId,
});
});
if (checked !== undefined) {
item.setAttribute("type", "checkbox");
if (checked) {
item.setAttribute("checked", true);
}