Usually the Botframework Webchat scrolls down on a new message, if the user didn't scroll up manually. Otherwise a button appears at the bottom right which lets you scroll down to the new message.
I would like to scroll down automatically, always. Currently I'm using this middleware that doesn't work well:
if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY' && document.querySelector('ul[role="list"]').lastChild && !scrollBarIsAtBottom()) {
document.querySelector('ul[role="list"]').lastElementChild.scrollIntoView(true);
const selector = document.querySelector("[role=log]");
if (selector && selector.lastElementChild && selector.lastElementChild.getAttribute('type') === 'button') {
selector.lastElementChild.setAttribute("hidden", "true");
}
}
It scrolls down automatically before the chat or card is fully rendered. The user has to scroll down manually again.
Is there a way to scroll down automatically after rendering?
We're using version 3 of the Botframework Webchat.