Closed BJJLangedijk closed 2 years ago
@BJJLangedijk Thanks for the PR and describing the issue and your code.
scroll a tiny bit up in the window and
shouldScrollToBottom()
would be false
I'm finding the output to be opposite, where scrolling back a tiny bit causes scrollable
to be true and scrolling back further (~180px in the demo app) will cause scrollable
to be false (as scrollTop
will turn to be less than this.$refs.scrollList.scrollHeight - 600
).
Although I did not write the current logic, I think it's saying that scrolling further up implies a deliberate action by the user where they may be trying to see older messages so they should not be forced all the way down on an update, while if the message list is only scrolled up a tiny bit, scrolling it to the bottom will not be jarring. @mattmezza hasn't been active here lately, but only he would be able to confirm -- I see you're from 🇳🇱, too, so would you mind knocking on his door : ]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Previously there was a hard coded value determining if the chat was able to scroll down. I am not sure where this value is coming from, but it seemed to me that even in the demo application it would not always scroll (scroll a tiny bit up in the window and
shouldScrollToBottom()
would be false.With this change it checks based on the clientHeight. This also solves issues in our application where we have styled things differently and the chat window/message list has a different height.
I added another check if the clientHeight is available since it would be 0 if the chat is closed.