Keep autocomplete inline with prompt
tests / test (push) Canceled after 0s
tests / windows-storage (push) Canceled after 0s

This commit is contained in:
2026-10-15 11:05:23 +00:00
parent f999e77382
commit d7eb81f9c1
+2 -8
View File
@@ -338,13 +338,7 @@ function configure(node) {
closeAutocomplete();
autocompleteRange = { start: at, end: at + 1 };
const menu = el("div");
menu.style.cssText = "position:absolute;z-index:30;min-width:220px;max-width:310px;padding:5px;background:#25282b;border:1px solid #4b5960;border-radius:8px;box-shadow:0 8px 24px #000b;color:#e7edf0;pointer-events:auto";
// Use the DOM layout offsets rather than viewport rectangles. The
// node canvas scales/transforms the widget, so mixing a viewport
// rect with an absolute child can move the menu to another part
// of the node.
menu.style.left = `${Math.max(5, Math.min(panel.clientWidth - 230, (prompt.offsetLeft || 0) + 14))}px`;
menu.style.top = `${Math.max(5, (prompt.offsetTop || 0) + 26)}px`;
menu.style.cssText = "position:relative;z-index:30;width:calc(100% - 8px);max-width:310px;margin:4px 4px 5px;padding:5px;background:#25282b;border:1px solid #4b5960;border-radius:8px;box-shadow:0 4px 12px #0008;color:#e7edf0;pointer-events:auto";
const connected = Array.from({ length: 9 }, (_, offset) => offset + 1)
.filter((index) => node.inputs?.some((input) => input.name === `reference_image_${index}` && input.link != null));
const addOption = (content, title, action) => {
@@ -382,7 +376,7 @@ function configure(node) {
syncPrompt(clip, clip.prompt); addSlot(clip); rebuildPromptAfterStructureChange(clip);
closeAutocomplete(); setState(); render();
});
panel.append(menu); autocomplete = menu;
panel.insertBefore(menu, prompt); autocomplete = menu;
};
prompt.oninput = () => { rememberPromptSelection(); promptText = prompt.value; clip.prompt = prompt.value; };
prompt.onselect = rememberPromptSelection;