fix(widgets): hide DOM widgets from Properties Panel to avoid WidgetLegacy width pollution

The frontend's right-side Properties Panel falls back to WidgetLegacy for
unregistered widget types, and WidgetLegacy.draw() writes widget.width
(≈panel width) onto the real widget object. The canvas DOM overlay honors
widget.width ?? node.width, so clicking a node with the panel open squashes
the widget content to the left until undo/recreate (ComfyUI_frontend #11574).

Setting hideInPanel: true on all addDOMWidget options keeps LM widgets out
of the panel entirely. Older frontends without the option ignore it safely.

Refs #979
This commit is contained in:
Will Miao
2026-09-30 10:52:15 +08:00
parent 18504c712c
commit 42fa8294df
5 changed files with 30 additions and 2 deletions
+10
View File
@@ -130,6 +130,11 @@ function createLoraPoolWidget(node) {
// No need for custom onSetValue mechanism
},
serialize: true,
// Keep LM DOM widgets out of the right-side Properties Panel: the panel
// falls back to WidgetLegacy for unknown widget types and writes
// widget.width onto the real widget, squashing the canvas overlay
// (ComfyUI_frontend #11574).
hideInPanel: true,
// Per dev guide: providing getMinHeight via options allows the system to
// skip expensive DOM measurements during rendering loop, improving performance
getMinHeight() {
@@ -213,6 +218,7 @@ function createLoraRandomizerWidget(node) {
// No need for custom onSetValue mechanism
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_RANDOMIZER_WIDGET_MIN_HEIGHT
}
@@ -314,6 +320,7 @@ function createLoraCyclerWidget(node) {
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_CYCLER_WIDGET_MIN_HEIGHT
}
@@ -385,6 +392,7 @@ function createJsonDisplayWidget(node) {
}
},
serialize: false, // Display-only widget - don't save metadata in workflows
hideInPanel: true,
getMinHeight() {
return JSON_DISPLAY_WIDGET_MIN_HEIGHT
}
@@ -690,6 +698,7 @@ function createLoraInfoWidget(node: any) {
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_INFO_WIDGET_MIN_HEIGHT
}
@@ -808,6 +817,7 @@ function createAutocompleteTextWidgetFactory(
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT
},