Skip to content

Commit bbe35e3

Browse files
committed
feat: add smooth scrolling
1 parent 0c571d4 commit bbe35e3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/currentVerse.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ export function CurrentVerse({
314314
inputRef.current?.focus()
315315
}}
316316
>
317+
<span
318+
id={'scroll-anchor'}
319+
className={'inline-block -translate-y-36'}
320+
/>
317321
{verse.nodes.map((atom, aIndexPrime) => {
318322
const aIndex = verse.nodes
319323
.slice(0, aIndexPrime)
@@ -428,6 +432,10 @@ export function CurrentVerse({
428432
onInput={handleInput}
429433
tabIndex={-1}
430434
onFocus={() => {
435+
document.getElementById('scroll-anchor')?.scrollIntoView({
436+
block: 'start',
437+
behavior: 'smooth',
438+
})
431439
setIsArenaFocused(true)
432440
}}
433441
onBlur={() => {

0 commit comments

Comments
 (0)