#8327·mermaid

Swimlanes: Node position changes when label is added to link

Author: GavinPenCreated Sep 27, 2026Updated Sep 28, 2026
LabelsType: Bug / ErrorStatus: Triage

Description

If 2 nodes in different swimlanes are connected by a link with no label, then when I add a label to the link, the second node moves.
This can mean that the nodes are no longer aligned.
Could swimlanes be reworked so that adding a label to an edge (or adding / removing an edge) doesn't change node position?

Steps to reproduce

Here's an example.

First without a link label:

mermaid
swimlane-beta TB
    subgraph s1
        1a
    end
    subgraph s2
        2a
    end
    1a --> 2a

And now with a link label:

mermaid
swimlane-beta TB
    subgraph s1
        1a
    end
    subgraph s2
        2a
    end
    1a -->|e| 2a 

Screenshots

No response

Code Sample

swimlane-beta TB
    subgraph s1
        1a
    end
    subgraph s2
        2a
    end
    1a -->|e| 2a

Setup

  • Mermaid version: 12.0.0
  • Browser and Version: Chrome 153.0.8010.54 (Official Build) (64-bit)

Suggested Solutions

No response

Additional Context

No response