Skip to content

Commit

Permalink
Less sensitive auto-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
mruwnik committed Nov 29, 2023
1 parent 8332cda commit 2920f73
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions web/src/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ type State =
response: AssistantEntryType;
};

// smooth-scroll to the bottom of the window if we're already less than 30% a screen away
// smooth-scroll to the bottom of the window if we're already less than 10% a screen away
// note: finicky interaction with "smooth" - maybe fix later.
function scroll30() {
if (
document.documentElement.scrollHeight - window.scrollY >
window.innerHeight * 1.3
)
return;
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
document.documentElement.scrollHeight - window.scrollY <
window.innerHeight * 1.1
) {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
}
}

const randomQuestion = () =>
Expand Down

0 comments on commit 2920f73

Please sign in to comment.