Skip to content

Scroll event is not triggering every time a message is received #1926

@keshavnagpal

Description

@keshavnagpal

here is a video to explain the issue
https://www.loom.com/share/f22dd7020a0a4c5ea53c3a88be87ffee
(pass: webchat)

i'm using master/webchat-es5 (dated 25-Apr-2019)

Update:
We implemented our own solution as a workaround for this, but it might not be as reliable as a fix in webchat library, pasting the implementation below:

var messageListSelector = '#chat-interface ul[role="list"][aria-live="polite"]';
var scrollControl = false;
When action.type === 'DIRECT_LINE/POST_ACTIVITY'
{
scrollControl = true;
}

When action.type === 'DIRECT_LINE/INCOMING_ACTIVITY'
{
if (scrollControl) {
        $(messageListSelector).parent().animate({ scrollTop: $(messageListSelector).height() }, 1000);
    }
    $('#chat-interface input[data-id="webchat-sendbox-input"]').focus();
}
//if user scroll up
$(document).ready(function(){
    $(messageListSelector).bind('mousewheel DOMMouseScroll', function(event){
        event.stopPropagation();
        scrollControl = false;
        var scrollPos = $(messageListSelector).parent().scrollTop();
        var elemHeight = $(messageListSelector).height();
        var srollSkew = elemHeight - scrollPos;
        if (srollSkew > 600 && srollSkew < 636) {
            scrollControl = true;
        }
    });
});

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.front-burnerp1Painful if we don't fix, won't block releasing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions