Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto scroll #42

Closed
benjaminpreiss opened this issue Mar 25, 2025 · 1 comment · Fixed by #43
Closed

auto scroll #42

benjaminpreiss opened this issue Mar 25, 2025 · 1 comment · Fixed by #43
Assignees
Labels

Comments

@benjaminpreiss
Copy link
Collaborator

benjaminpreiss commented Mar 25, 2025

thread view should auto-scroll up on:

  • switch to thread view
  • new contents being inserted at top of thread view (if were scrolled to top before.)

Also switch to a scroll trigger based on scroll height diff and not element insertion.

@benjaminpreiss benjaminpreiss self-assigned this Mar 25, 2025
@benjaminpreiss benjaminpreiss linked a pull request Mar 25, 2025 that will close this issue
@benjaminpreiss benjaminpreiss changed the title thread auto scroll auto scroll Mar 25, 2025
@benjaminpreiss
Copy link
Collaborator Author

Some more thoughts:

  • Watch body height change with resize observer. Don't debounce, as it triggers max. 60 times per second anyway (every 10 ms)
  • Also watch window resizes (only shrinks!). As one resizes the window, we'd want to update the scroll position (e.g.). Debounce (not throttle).

Scroll to bottom on the following events:

  • freshly navigated to chat view (no event necessary, no conflict if resize observer fires)
  • new element gets added to chat view, and it's either mine or I was(!!) already scrolled to the bottom (resize observer event, no conflict with window resize)
  • window resize, and I was already scrolled to the bottom (window resize event, no conflict with resize observer)
Event Condition Action
freshly navigated to chat view true scrollToBottom
resize observer event (on body element) latest element is either mine or I was(!!) already scrolled to the bottom scrollToBottom
window resize (debounced!) I was already scrolled to the bottom scrollToBottom
- - -
freshly navigated to thread view true scrollToTop (I think this is happening automatically)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant