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
},
+5 -1
View File
@@ -852,7 +852,11 @@ export function addLorasWidget(node, name, opts, callback) {
}
},
hideOnZoom: true,
selectOn: ['click', 'focus']
selectOn: ['click', 'focus'],
// Keep this DOM widget out of the right-side Properties Panel: the panel
// falls back to WidgetLegacy for unknown widget types and writes
// widget.width, which squashes the canvas overlay (frontend #11574).
hideInPanel: true
});
widget.value = defaultValue;
+4
View File
@@ -968,6 +968,10 @@ export function addTagsWidget(node, name, opts, callback, wheelSensitivity = 0.0
getMinHeight: () => MIN_HEIGHT,
hideOnZoom: true,
selectOn: ["click", "focus"],
// Keep this DOM widget out of the right-side Properties Panel: the panel
// falls back to WidgetLegacy for unknown widget types and writes
// widget.width, which squashes the canvas overlay (frontend #11574).
hideInPanel: true,
});
widget.value = initialTagsData;
@@ -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