Skip to content

Commit

Permalink
feat: add smooth scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawootonn committed Dec 19, 2023
1 parent 0c571d4 commit bbe35e3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/currentVerse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ export function CurrentVerse({
inputRef.current?.focus()
}}
>
<span
id={'scroll-anchor'}
className={'inline-block -translate-y-36'}
/>
{verse.nodes.map((atom, aIndexPrime) => {
const aIndex = verse.nodes
.slice(0, aIndexPrime)
Expand Down Expand Up @@ -428,6 +432,10 @@ export function CurrentVerse({
onInput={handleInput}
tabIndex={-1}
onFocus={() => {
document.getElementById('scroll-anchor')?.scrollIntoView({
block: 'start',
behavior: 'smooth',
})
setIsArenaFocused(true)
}}
onBlur={() => {
Expand Down

0 comments on commit bbe35e3

Please sign in to comment.