diff --git a/src/components/Player/TextBuffer.jsx b/src/components/Player/TextBuffer.jsx index 9de6074..eaa149a 100644 --- a/src/components/Player/TextBuffer.jsx +++ b/src/components/Player/TextBuffer.jsx @@ -67,10 +67,12 @@ export default function TextBuffer ({ inbox, currentWindow }) { const lastInput = inputs[inputs.length - 1] - textBufferEl.current.scrollTop = - lastInput + textBufferEl.current.scrollTo({ + top: lastInput ? lastInput.offsetTop - : textBufferEl.current.scrollHeight * 2 + : textBufferEl.current.scrollHeight, + behavior: 'smooth', + }) }, 0) }, [currentWindow, inbox]) diff --git a/src/components/Player/player.css b/src/components/Player/player.css index 9c3671a..dff5873 100644 --- a/src/components/Player/player.css +++ b/src/components/Player/player.css @@ -78,6 +78,7 @@ .ifplayer .output .textBuffer { flex: 2 1; outline: none; + scroll-behavior: smooth; } .ifplayer .output .textBuffer > br:first-child,