From 56a800962de4a9fbf1437d63bee40a4e4832be29 Mon Sep 17 00:00:00 2001 From: hcwhan Date: Fri, 17 Jul 2026 17:38:56 +0800 Subject: [PATCH] Fix progress bar context menu title showing raw HTML on newer frontends Newer ComfyUI frontends render the ContextMenu title via textContent instead of innerHTML (XSS hardening), so the HTML string passed as the progress bar menu title was displayed as raw markup. Pass a plain-text title and swap in the logo markup after the menu is created. --- src_web/comfyui/rgthree.ts | 11 +++++++++-- web/comfyui/rgthree.js | 8 ++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src_web/comfyui/rgthree.ts b/src_web/comfyui/rgthree.ts index 206cb93..6e40ea2 100644 --- a/src_web/comfyui/rgthree.ts +++ b/src_web/comfyui/rgthree.ts @@ -320,11 +320,18 @@ class Rgthree extends EventTarget { LiteGraph.closeAllContextMenus(); if (e.button == 2) { const canvas = await waitForCanvas(); - new LiteGraph.ContextMenu(this.getRgthreeIContextMenuValues(), { - title: `
${logoRgthree} rgthree-comfy
`, + // Newer ComfyUI frontends render the ContextMenu title with textContent (no HTML + // parsing), which would show an HTML title as raw markup. Pass a plain-text title, + // then swap in our logo markup afterwards. + const menu = new LiteGraph.ContextMenu(this.getRgthreeIContextMenuValues(), { + title: "rgthree-comfy", left: e.clientX, top: 5, }); + const titleEl = query(".litemenu-title", menu.root); + if (titleEl) { + titleEl.innerHTML = `
${logoRgthree} rgthree-comfy
`; + } return; } if (e.button == 0) { diff --git a/web/comfyui/rgthree.js b/web/comfyui/rgthree.js index ec4bfa7..5b63959 100644 --- a/web/comfyui/rgthree.js +++ b/web/comfyui/rgthree.js @@ -188,11 +188,15 @@ class Rgthree extends EventTarget { LiteGraph.closeAllContextMenus(); if (e.button == 2) { const canvas = await waitForCanvas(); - new LiteGraph.ContextMenu(this.getRgthreeIContextMenuValues(), { - title: `
${logoRgthree} rgthree-comfy
`, + const menu = new LiteGraph.ContextMenu(this.getRgthreeIContextMenuValues(), { + title: "rgthree-comfy", left: e.clientX, top: 5, }); + const titleEl = query(".litemenu-title", menu.root); + if (titleEl) { + titleEl.innerHTML = `
${logoRgthree} rgthree-comfy
`; + } return; } if (e.button == 0) {