Skip to content

Commit 2ef8b7c

Browse files
webfilteredgithub-actions
andauthored
Fix opening search from context menu (#3591)
Co-authored-by: github-actions <[email protected]>
1 parent 9cf3a0e commit 2ef8b7c

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

browser_tests/tests/nodeSearchBox.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,17 @@ test.describe('Release context menu', () => {
251251
'link-release-context-menu.png'
252252
)
253253
})
254+
255+
test('Can search and add node from context menu', async ({
256+
comfyPage,
257+
comfyMouse
258+
}) => {
259+
await comfyPage.disconnectEdge()
260+
await comfyMouse.move({ x: 10, y: 10 })
261+
await comfyPage.clickContextMenuItem('Search')
262+
await comfyPage.searchBox.fillAndSelectFirstNode('CLIP Prompt')
263+
await expect(comfyPage.canvas).toHaveScreenshot(
264+
'link-context-menu-search.png'
265+
)
266+
})
254267
})

src/components/searchbox/NodeSearchBoxPopover.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ const showContextMenu = (e: CanvasPointerEvent) => {
158158
const commonOptions = {
159159
e,
160160
allow_searchbox: true,
161-
showSearchBox: () => showSearchBox(e)
161+
showSearchBox: () => {
162+
cancelResetOnContextClose()
163+
showSearchBox(e)
164+
}
162165
}
163166
const connectionOptions =
164167
toType === 'input'
@@ -200,7 +203,12 @@ const showContextMenu = (e: CanvasPointerEvent) => {
200203
)
201204
202205
// Reset when the context menu is closed
203-
useEventListener(menu.controller.signal, 'abort', reset, options)
206+
const cancelResetOnContextClose = useEventListener(
207+
menu.controller.signal,
208+
'abort',
209+
reset,
210+
options
211+
)
204212
}
205213
206214
// Disable litegraph's default behavior of release link and search box.

0 commit comments

Comments
 (0)