theomessin / vue-chat-scroll

🖱️ Vue directive to keep things scrolled to the bottom.
https://jsfiddle.net/theomessin/n7542hk1/
MIT License
573 stars 76 forks source link

Scrolling not working if messages are covered with container #83

Open avfirsov opened 4 years ago

avfirsov commented 4 years ago

Describe the bug My problem and solution are clearly described here: https://stackoverflow.com/questions/50455751/vue-chat-scroll-doesnt-work-with-a-loader

A working demo reproducing the problem: https://jsfiddle.net/StpFlp_DDK/6s0kbtkr/

Why it is matter In my case, I have a distinct categories for read and unread messages, each having separate container. And when new unread messages arrive, they attached to the unread messages container. Thus, the change in elements count is not detected now and scrolling is not working in this case. I think it is a common practice to split chat messages into categories or groups, not extactly into read and unread, but maybe groupping them by send date, and if new message arrived e.g. not later than 5 minute after last one, it is attached to last group. Or consider groupping by sender. Just look at any modern IM, like Telegram, WhatsApp, etc.. - they all use some or even several types of groupping messages at once.

theomessin commented 4 years ago

Version 2 should solve this issue as it'll be using a ResizeObserver (see #72).

vortechron commented 4 years ago

@theomessin when ver 2 will release?

theomessin commented 4 years ago

@vortechron Soon™. This is an open-source project, feel free to contribute to the alpha branch 😉. Too busy flying at the moment 🛩️

vortechron commented 4 years ago

@theomessin sry, just asking.. tq for the awesome package 👍

vesper8 commented 4 years ago

@theomessin would you say that the alpha branch is currently usable? I can imagine the warning of "don't use this in production" but I am in the same situation as the commenters in this issue so.. does the alpha branch currently resolve this issue?

Thanks! Also really looking forward to v2 : )

theomessin commented 4 years ago

Hi @vesper8. I'll try to get some v2 work done this week. I'd avoid using the alpha just yet. The next alpha will have massive breaking changes as I'll be switching to ResizeObservers (this will mean you have to change your html layout to support v-chat-scroll. As always, yes you can use it - you just might run into issues. I'll let you know when the new alpha is out which will solve this issue.