diff --git a/packages/renderer/MdToHtml/rules/mermaid.ts b/packages/renderer/MdToHtml/rules/mermaid.ts
index 43c4b5bc243..4a42def0e7d 100644
--- a/packages/renderer/MdToHtml/rules/mermaid.ts
+++ b/packages/renderer/MdToHtml/rules/mermaid.ts
@@ -22,6 +22,8 @@ export default {
.mermaid-export-graph {
opacity: 0;
height: 0;
+ z-index: 1;
+ position: relative;
}
.joplin-editable:hover .mermaid-export-graph,
.joplin-editable .mermaid-export-graph:has(:focus-visible) {