Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#565 from xiaotianxt/main
Browse files Browse the repository at this point in the history
fix: distinguish PC/Mobile behavior on auto-scroll
  • Loading branch information
Yidadaa authored Apr 6, 2023
2 parents cd3a11b + dd20c36 commit 9a952f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ export function Chat(props: {
// check if should send message
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (shouldSubmit(e)) {
setAutoScroll(true);
onUserSubmit();
e.preventDefault();
}
Expand Down Expand Up @@ -667,7 +668,7 @@ export function Chat(props: {
onInput={(e) => onInput(e.currentTarget.value)}
value={userInput}
onKeyDown={onInputKeyDown}
onFocus={() => setAutoScroll(true)}
onFocus={() => setAutoScroll(isMobileScreen())}
onBlur={() => {
setAutoScroll(false);
setTimeout(() => setPromptHints([]), 500);
Expand Down

0 comments on commit 9a952f0

Please sign in to comment.