diff --git a/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx b/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx index b4fd610e28b..5d963a9f550 100644 --- a/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx +++ b/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx @@ -2,7 +2,7 @@ import type { PropsWithChildren } from 'react' import type { CommonNodeType } from '@/app/components/workflow/types' import { fireEvent, screen } from '@testing-library/react' import { renderWorkflowComponent } from '@/app/components/workflow/__tests__/workflow-test-env' -import { BlockEnum, NodeRunningStatus } from '@/app/components/workflow/types' +import { BlockEnum, ControlMode, NodeRunningStatus } from '@/app/components/workflow/types' import BaseNode from '../node' const mockHasNodeInspectVars = vi.fn() @@ -161,6 +161,23 @@ describe('BaseNode', () => { expect(selectWorkflowNode).toHaveBeenCalledWith('node-1') }) + it('should not select the node from the title button while in comment mode', async () => { + const { selectWorkflowNode } = await import('@/app/components/workflow/utils/node-navigation') + + renderWorkflowComponent( + +
Body
+
, + { initialStoreState: { controlMode: ControlMode.Comment } }, + ) + + const node = screen.getByRole('button', { name: 'Node title' }) + + fireEvent.click(node) + + expect(selectWorkflowNode).not.toHaveBeenCalled() + }) + it('should keep header metadata outside the selectable button', () => { renderWorkflowComponent( = ({ id, data, children }) => { type="button" aria-label={data.title} className="mr-1 flex min-w-0 grow appearance-none items-center rounded-md border-0 bg-transparent p-0 text-left focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden" - onClick={() => selectWorkflowNode(id)} + onClick={() => { + // In comment mode, clicking a node should not open the node settings panel: + // the right-hand panel covers the canvas region where the comment is anchored. + // Mirrors the comment-mode guard in use-nodes-interactions' handleNodeClick. + if (controlMode === ControlMode.Comment) return + selectWorkflowNode(id) + }} >