Skip to content

Commit

Permalink
fix: scroll when adding new cell at the bottom (#1782)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick authored Jul 11, 2024
1 parent b0efec0 commit f936c92
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion frontend/src/core/cells/cells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/core/cells/scrollCellIntoView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f936c92

Please sign in to comment.