BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Scrolling behaviour together with the webchat/join - event: The Chatbot doesn't scroll correctly.

Open MatthiasGwiozda opened this issue 3 years ago • 9 comments

Screenshots

BUG

Version

latest (current version: 4.13.0)

Describe the bug

When using the welcome - event in combination with the autoScrollSnapOnActivity - option, the welcome message will not be seen completly.

Steps to reproduce

  1. create a backend which answers to the webchat/join event with a long message
  2. use this frontend - example (with your token):
<!DOCTYPE html>
<html>

<head>
    <script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
    <style>
        html,
        body {
            height: 100%;
        }

        body {
            margin: 0;
        }

        #webchat {
            height: 100%;
            width: 100%;
        }
    </style>
</head>

<body>
    <div id="webchat" role="main"></div>
    <script>
        const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
          if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
            dispatch({
              type: 'WEB_CHAT/SEND_EVENT',
              payload: {
                name: 'webchat/join',
                value: { language: window.navigator.language }
              }
            });
          }

          return next(action);
        });

        window.WebChat.renderWebChat(
            {
                directLine: window.WebChat.createDirectLine({
                    token: 'INSERT_TOKEN_HERE'
                }),
                userID: 'YOUR_USER_ID',
                username: 'Web Chat User',
                locale: 'de-de',
                store,
                styleOptions: {
                    bubbleBackground: 'rgba(0, 255, 255, .1)',
                    autoScrollSnapOnActivity: true,
                }
            },
            document.getElementById('webchat')
        );
    </script>
</body>

</html>
  1. open the chatbot in a small window

Expected behavior

The welcome - message should be seen completly. But the chatbot scrolls to the bottom of the message.

Additional context

Not 100% sure if this behaviour is intended or a bug. But I feel like this would be an intuitive addition to the scrolling - behaviour feature.

I have read the following information:

Due to the limitation of chat adapter, we recommend content author not to send initial activities (a.k.a. welcome messages) longer than a page.

But for us it's just not feasible to follow this recommendation.

MatthiasGwiozda avatar Apr 13 '21 06:04 MatthiasGwiozda

Thanks for the very detailed report! For 100% clarity, would you mind recording a video clip of the (incorrect) behavior and sharing here?

Were you able to experiment with the styleOption features available in #3653? Under the 'Description' section, you can see a video that pauses partially down the scrollbar.

image

image

Could you fiddle with these options and see if you are able to get behavior closer to what you're looking for?

P.S. Just in case you find it helpful, please use the following link for more information on welcome messages: https://github.com/microsoft/BotFramework-WebChat/blob/master/docs/WELCOME_MESSAGE.md

corinagum avatar Apr 13 '21 18:04 corinagum

would you mind recording a video clip of the (incorrect) behavior

I've edited the question and added a gif

Were you able to experiment with the styleOption features available in #3653?

Yes I tried some options. But none of them fixed this problem.

MatthiasGwiozda avatar Apr 19 '21 08:04 MatthiasGwiozda

@MatthiasGwiozda Great, thanks for this info. My next step is to try recreating the bug you're experiencing. If I'm having problems I may ask for some more info from you. I'll report back soon!

One more question - is this behavior that recently broke for you? Or is this a newly created bot with no previous behavior available for comparison?

corinagum avatar Apr 19 '21 17:04 corinagum

@MatthiasGwiozda I was able to reproduce this issue, but I did find the following comment from the PR 3653 linked above:

Due to the limitation of chat adapter, we recommend content author not to send initial activities (a.k.a. welcome messages) longer than a page.

This is known behavior and could be resolved by sending a shorter welcome message.

@compulim is there a plan to work on this behavior in the future? Can we get more info/documentation on what the limitations are?

Reassigning to compulim for input. Do we want to make this an action item?

corinagum avatar Apr 19 '21 19:04 corinagum

is this behavior that recently broke for you? Or is this a newly created bot with no previous behavior available for comparison?

It always behaved like this. The reason why I consider this to be a "bug" is because it feels like the scroll - behaviour should integrate the welcome - message aswell as all the other messages from the bot.

MatthiasGwiozda avatar Apr 20 '21 06:04 MatthiasGwiozda

we have the same problem

Gusi88 avatar Apr 21 '21 07:04 Gusi88

@Gusi88 Thanks! Additional chime-ins help us with prioritization. :)

corinagum avatar Apr 21 '21 19:04 corinagum

@corinagum This is still an issue for us. @MatthiasGwiozda Do you have a good workaround?

nodueck avatar Aug 10 '22 14:08 nodueck

@nodueck I don't have a workaround - currently our chatbot users need to scroll up to see the whole message.

MatthiasGwiozda avatar Aug 12 '22 11:08 MatthiasGwiozda