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
@@ -16247,6 +16247,11 @@ function createLoraPoolWidget(node) {
internalValue = v2;
},
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() {
@@ -16315,6 +16320,7 @@ function createLoraRandomizerWidget(node) {
internalValue = v2;
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_RANDOMIZER_WIDGET_MIN_HEIGHT;
}
@@ -16396,6 +16402,7 @@ function createLoraCyclerWidget(node) {
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_CYCLER_WIDGET_MIN_HEIGHT;
}
@@ -16454,6 +16461,7 @@ function createJsonDisplayWidget(node) {
},
serialize: false,
// Display-only widget - don't save metadata in workflows
hideInPanel: true,
getMinHeight() {
return JSON_DISPLAY_WIDGET_MIN_HEIGHT;
}
@@ -16679,6 +16687,7 @@ function createLoraInfoWidget(node) {
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return LORA_INFO_WIDGET_MIN_HEIGHT;
}
@@ -16772,6 +16781,7 @@ function createAutocompleteTextWidgetFactory(node, widgetName, modelType, inputO
}
},
serialize: true,
hideInPanel: true,
getMinHeight() {
return AUTOCOMPLETE_TEXT_WIDGET_MIN_HEIGHT;
},
File diff suppressed because one or more lines are too long