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 to bottom on createNewCell (#4903)

Shahmir Varqha98a1a7964518
diff --git a/frontend/src/components/editor/database/add-database-form.tsx b/frontend/src/components/editor/database/add-database-form.tsx
index 5ea01d5477..4943dbc60e 100644
--- a/frontend/src/components/editor/database/add-database-form.tsx
+++ b/frontend/src/components/editor/database/add-database-form.tsx
@@ -278,7 +278,6 @@ const DatabaseForm: React.FC<{
before: false,
cellId: lastFocusedCellId ?? "__end__",
skipIfCodeExists: true,
- autoFocus: true,
});
};
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index 5fb427510d..e73bd69b44 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -1002,21 +1002,16 @@ const {
const column = state.cellIds.findWithId(scrollKey);
const index = column.indexOfOrThrow(scrollKey);
- // Special-case scrolling to the end of the page: bug in Chrome where
- // browser fails to scrollIntoView an element at the end of a long page
- if (index === column.length - 1) {
- const cellId = column.last();
- state.cellHandles[cellId].current?.editorViewOrNull?.focus();
- } else {
- const nextCellId = column.atOrThrow(index);
- focusAndScrollCellIntoView({
- cellId: nextCellId,
- cell: state.cellHandles[nextCellId],
- config: state.cellData[nextCellId].config,
- codeFocus: undefined,
- variableName: undefined,
- });
- }
+ const cellId =
+ index === column.length - 1 ? column.last() : column.atOrThrow(index);
+
+ focusAndScrollCellIntoView({
+ cellId: cellId,
+ cell: state.cellHandles[cellId],
+ config: state.cellData[cellId].config,
+ codeFocus: undefined,
+ variableName: undefined,
+ });
return {
...state,