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: scroll when adding new cell at the bottom (#1782)

Myles Scolnickf936c92b76cc
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index 9d17203474..8759a4b6b9 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -663,7 +663,6 @@ const {
if (index === state.cellIds.length - 1) {
const cellId = state.cellIds[state.cellIds.length - 1];
state.cellHandles[cellId].current?.editorView.focus();
- scrollToBottom();
} else {
const nextCellId = state.cellIds[index];
focusAndScrollCellIntoView({
diff --git a/frontend/src/core/cells/scrollCellIntoView.ts b/frontend/src/core/cells/scrollCellIntoView.ts
index b9153487e2..e5926ad918 100644
--- a/frontend/src/core/cells/scrollCellIntoView.ts
+++ b/frontend/src/core/cells/scrollCellIntoView.ts
@@ -94,7 +94,7 @@ export function focusAndScrollCellOutputIntoView(cellId: CellId) {
*/
export function scrollToBottom() {
const app = document.getElementById("App");
- app?.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
+ app?.scrollTo({ top: app.scrollHeight, behavior: "smooth" });
}
export function scrollToTop() {