diff --git a/packages/mermaid/src/diagrams/common/svgDrawCommon.ts b/packages/mermaid/src/diagrams/common/svgDrawCommon.ts index 6bf445ecf7..cf962f33ec 100644 --- a/packages/mermaid/src/diagrams/common/svgDrawCommon.ts +++ b/packages/mermaid/src/diagrams/common/svgDrawCommon.ts @@ -21,7 +21,9 @@ export const drawRect = (element: SVG | Group, rectData: RectData): D3RectElemen rectElement.attr('stroke', rectData.stroke); rectElement.attr('width', rectData.width); rectElement.attr('height', rectData.height); - rectElement.attr('name', rectData.name); + if (rectData.name) { + rectElement.attr('name', rectData.name); + } rectData.rx !== undefined && rectElement.attr('rx', rectData.rx); rectData.ry !== undefined && rectElement.attr('ry', rectData.ry);