Merged
Size
M
Change Breakdown
Bug Fix85%
Maintenance15%
#28421fix(core): Position workflow correctly if opened while on a background tab (no-changelog)

Workflow canvas positioned correctly when tab is backgrounded

Workflow canvases now correctly position themselves when users return to a browser tab that was in the background when workflow generation finished — no more stuck or misaligned views.

When n8n workflows are accessed in a browser tab that was hidden during generation, the canvas viewport was incorrectly positioned. This happens because VueFlow — the graph-rendering library powering the canvas — reports zero container dimensions when a tab is hidden, falling back to a default 500×500 viewport that places the workflow off-center or at the wrong zoom level.

The fix detects when viewport positioning runs while the tab is hidden, then re-applies it once the tab becomes visible. Canvas resize adjustments are also skipped when the prior measurement came from a hidden state, preventing meaningless dimension deltas (like 500→769) from shifting the viewport away from where it was just correctly placed.

This resolves the issue for AI artifacts workflows specifically while remaining invisible during normal foreground tab usage — it only activates when the problematic sequence occurs.

View Original GitHub Description

Summary

On instance AI artifacts if the tab was on background while WF generation finished we failed to position the canvas correctly. Add logic to reposition it correctly when visibility changes in that case. This shouldn't affect the regular canvas view in negative / noticeable way.

Related Linear tickets, Github issues, and Community forum posts

Notion: Workflow artifact does zoom/fit wrong

<!-- Include links to **Linear ticket** or Github issue or Community forum post. Important in order to close *automatically* and provide context to reviewers. https://linear.app/n8n/issue/[TICKET-ID] --> <!-- Use "closes #<issue-number>", "fixes #<issue-number>", or "resolves #<issue-number>" to automatically close issues when the PR is merged. -->

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions) <!-- **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** -->
  • Docs updated or follow-up ticket created.
  • Tests included. <!-- A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. -->
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)
© 2026 · via Gitpulse