diff --git a/web/app/components/workflow/hooks/use-workflow-comment.ts b/web/app/components/workflow/hooks/use-workflow-comment.ts index 73c8e9e947..2eb6ca0d90 100644 --- a/web/app/components/workflow/hooks/use-workflow-comment.ts +++ b/web/app/components/workflow/hooks/use-workflow-comment.ts @@ -133,7 +133,15 @@ export const useWorkflowComment = () => { const cachedDetail = commentDetailCacheRef.current[comment.id] setActiveComment(cachedDetail || comment) - reactflow.setCenter(comment.position_x, comment.position_y, { zoom: 1, duration: 600 }) + let horizontalOffsetPx = 220 + const maxOffset = Math.max(0, (window.innerWidth / 2) - 60) + horizontalOffsetPx = Math.min(horizontalOffsetPx, maxOffset) + + reactflow.setCenter( + comment.position_x + horizontalOffsetPx, + comment.position_y, + { zoom: 1, duration: 600 }, + ) if (!appId) return