Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: add additional padding for scrollbar on resize (#942)

Myles Scolnickbb2f605fd845
diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml
index 2a3c246e2e..276784b28b 100644
--- a/.github/workflows/dev-release.yml
+++ b/.github/workflows/dev-release.yml
@@ -102,8 +102,8 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullRequest.data.items[0].number,
- body: '🚀 Development release published. You may be able to view the changes at https://marimo.app?v${{ env.MARIMO_VERSION }}'
+ body: '🚀 Development release published. You may be able to view the changes at https://marimo.app?v=${{ env.MARIMO_VERSION }}'
});
} catch (err) {
- // ignore
+ console.error(err);
}
diff --git a/frontend/index.html b/frontend/index.html
index c715fe31c4..239fae7466 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -24,14 +24,21 @@
<script data-marimo="true">
function __resizeIframe(obj) {
- // Resize the iframe to the height of the content
- obj.style.height =
- obj.contentWindow.document.documentElement.scrollHeight + "px";
+ var scrollbarHeight = 20; // Max between windows, mac, and linux
+
+ function setHeight() {
+ var element = obj.contentWindow.document.documentElement;
+ var hasHorizontalScrollbar = element.scrollWidth > element.clientWidth;
+ var height = element.scrollHeight + (hasHorizontalScrollbar ? scrollbarHeight : 0);
+ obj.style.height = `${height}px`;
+ }
+
+ // Resize the iframe to the height of the content and bottom scrollbar height
+ setHeight();
// Resize the iframe when the content changes
const resizeObserver = new ResizeObserver((entries) => {
- obj.style.height =
- obj.contentWindow.document.documentElement.scrollHeight + "px";
+ setHeight();
});
resizeObserver.observe(obj.contentWindow.document.body);
}
diff --git a/marimo/_smoke_tests/bugs/924.py b/marimo/_smoke_tests/bugs/924.py
new file mode 100644
index 0000000000..f676d375a5
--- /dev/null
+++ b/marimo/_smoke_tests/bugs/924.py
@@ -0,0 +1,50 @@
+import marimo
+
+__generated_with = "0.3.2"
+app = marimo.App(width="full")
+
+
+def __(mo):
+ mo.md(
+ """
+ # Scrollbar issue with iframed altair
+
+ There should be no vertical scrollbar within the iframed container.
+
+ """
+ )
+ return
+
+
+def __():
+ import micropip
+ import altair as alt
+
+ import marimo as mo
+ import numpy as np
+ import pandas as pd
+
+ np.random.seed(11)
+ N = 100
+ x = np.linspace(0, 300, num=N)
+ y = np.linspace(0, 300, num=N)
+
+ df = pd.DataFrame({"x": x, "y": y})
+
+ graph = (
+ alt.Chart(df)
+ .mark_circle()
+ .encode(
+ x="x:Q",
+ y="y:Q",
+ )
+ .properties(width=1820, height=780)
+ )
+ graph
+ return N, alt, df, graph, micropip, mo, np, pd, x, y
+
+
+if __name__ == "__main__":
+ app.run()