Skip to content

Commit b57f801

Browse files
phrontizoclaude
andcommitted
fix: hide diagram scrollbars via CSS on .mxgraph element
Root cause: GraphViewer's layout phase compares the diagram's natural bounds against the container width and sets overflow:auto on the .mxgraph element itself — after any JS setTimeout callbacks. Previous attempts targeted child elements (.geDiagramContainer) that don't exist, or used JS timing that ran before GraphViewer's layout. CSS !important on .mxgraph directly overrides inline styles regardless of when GraphViewer sets them. The diagram content is already scaled to fit (resize:true), so hiding overflow loses nothing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0cc8ccb commit b57f801

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

Markdown/Resources/render.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,6 @@
316316
var hasTabs = tabBar && tabBar.classList.contains("drawio-tabs");
317317
el.innerText = "";
318318
GraphViewer.createViewerForElement(el, function(viewer) {
319-
setTimeout(function() {
320-
var divs = el.getElementsByTagName("div");
321-
for (var ci = 0; ci < divs.length; ci++) divs[ci].style.overflow = "hidden";
322-
}, 0);
323319
if (!hasTabs) return;
324320
var initial = parseInt(tabBar.getAttribute("data-initial-page"), 10) || 0;
325321
if (initial > 0) viewer.selectPage(initial);

Markdown/Resources/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ li + li { margin-top: 0.25em; }
293293
.mxgraph {
294294
margin: 16px 0;
295295
max-width: 100%;
296+
overflow: hidden !important;
296297
}
297298

298299
/* --- Footnotes --- */

0 commit comments

Comments
 (0)