Skip to content

Commit

Permalink
scroll to top AFTER a question is added to top of state
Browse files Browse the repository at this point in the history
  • Loading branch information
Aprillion committed Jul 6, 2023
1 parent aa81224 commit 30421ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/hooks/useQuestionStateInUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ export default function useQuestionStateInUrl(minLogo: boolean, initialQuestions
}

const moveToTop = (currentState: string, {pageid}: Question) => {
window.scrollTo({
top: 0,
behavior: 'smooth',
setTimeout(() => {
// scroll to top after the state is updated
window.scrollTo({
top: 0,
behavior: 'smooth',
})
})
return moveQuestionToTop(currentState, pageid)
}
Expand Down

0 comments on commit 30421ae

Please sign in to comment.