Skip to content

Commit

Permalink
fix(zbugs): Manually control scrolling when comments change (#3398)
Browse files Browse the repository at this point in the history
There are 3 cases we care about (in order of priority):

1. When we are near the top and the issue description is in the viewport
   we do not need to manipulate the scroll position.
2. When we are near the end of the page (currently hardcoded to 175px
   because that is the size of the new comment input and button) we
   maintain the scrollBottom (there is no such property but we compute
   it).
3. Otherwise use the first (partial) comment in the viewport as the
   anchor and we remember its distance to the top edge. When we restore
   the scroll position we keep the same distance.

We find the best anchor point during scroll.

And we restore/fix the scroll position when comments change.
  • Loading branch information
arv authored Dec 17, 2024
1 parent d52e8b9 commit b796bbe
Showing 1 changed file with 302 additions and 211 deletions.
Loading

0 comments on commit b796bbe

Please sign in to comment.