mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
fix(ui): re-measure autocomplete scrollbar inset on programmatic value changes
The --lm-vscrollbar-width inset from 634ea7f2 was only refreshed on input
events, mount and mode changes. Programmatic value updates (widget.setValue
from "send lora to workflow", external value-change events) change the
textarea content without an input event, leaving the corner clear (x)
button overlapping a freshly appeared classic scrollbar until the next
keystroke. Mount-time pending value replay was already covered.
- onExternalValueChange and widget.onSetValue now call
updateVScrollbarWidth() alongside the hasText update
- tests: cover both paths by overriding textarea metrics to an overflowing
state and asserting the 15px gutter lands in the CSS var
This commit is contained in:
@@ -200,6 +200,9 @@ const onWheel = (event: WheelEvent) => {
|
||||
|
||||
// Handle external value changes (e.g., from "send lora to workflow")
|
||||
const onExternalValueChange = () => {
|
||||
// The DOM value was set synchronously by the caller; the new content may
|
||||
// have toggled the vertical scrollbar on/off.
|
||||
updateVScrollbarWidth()
|
||||
updateHasTextState()
|
||||
}
|
||||
|
||||
@@ -209,6 +212,9 @@ const setupWidgetOnSetValue = () => {
|
||||
props.widget.onSetValue = (value: string) => {
|
||||
// The DOM value is already set by setValue, just update our state
|
||||
hasText.value = value.length > 0
|
||||
// Programmatic sets can toggle the scrollbar; re-measure so the
|
||||
// corner clear button stays clear of it.
|
||||
updateVScrollbarWidth()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user