microsoft / microsoft/BotFramework-WebChat

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

Open
#3,845 9 comments 2 reactions 1 assignee View on GitHub

@compulim is already working on this.

Since Apr 19, 2021.

Bot Services bug customer-replied-to customer-reported ExemptFromDailyDRIReport
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.