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

Action.ToggleVisibility in Web Chat creates console.log error

Open t-sperling opened this issue 2 years ago • 1 comments

Is it an issue related to Adaptive Cards?

Yes, this is an Adaptive Card issue, however it only repro on Web Chat.

Is this an accessibility issue?

No

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

NPM

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

Browser: Edge (latest), Browser: Chrome (latest), Browser: Firefox (latest)

Which area does this issue affect?

Others or unrelated

What is the public URL for the website?

No response

Please describe the bug

When using the "Action.ToggleVisibility" in an Adaptive Card in the latest WebChat version the console logs the attached error and the action object. The "Action.ToggleVisibility" works as expected.

The error handling seems to be defined in this file:

https://github.com/microsoft/BotFramework-WebChat/blob/2c2d9f209d0ead61fa2a47af3db74c79c3e75b30/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx#L123C1-L161C8

Do you see any errors in console log?

webchat.js:2 Web Chat: received unknown action from Adaptive Cards

How to reproduce the issue?

  1. Setup WebChat Frontend with https://github.com/microsoft/BotFramework-WebChat#integrate-with-javascript
  2. Integrate Backend
  3. Apply the attached adaptive card to a webchat dialogue
  4. Trigger the defined dialog in the frontend
  5. Click the toggle testblock button
  6. Testblock text toggles its visibilty
  7. Developer console prints error

What do you expect?

When toggling the visibility via Action.ToggleVisibility I expect the visibility of the elements that are defined to be toggled. Furthermore when this happens as expected i dont expect error logging in the developer console.

What actually happened?

The defined elements visibility is toggled correctly but the developer console print the attached error including the handled action object.

Do you have any screenshots or recordings to repro the issue?

No response

Adaptive Card JSON

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "id": "name_container",
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Name",
                    "id": "name_label"
                },
                {
                    "type": "Input.Text",
                    "placeholder": "Name",
                    "spacing": "None",
                    "id": "name_input"
                }
            ]
        },
        {
            "id": "toggle_container",
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Testblock",
                    "wrap": true,
                    "id": "testblock",
                    "isVisible": false
                },
                {
                    "id": "testblock_toggler",
                    "type": "ActionSet",
                    "actions": [
                        {
                            "type": "Action.ToggleVisibility",
                            "title": "Toggle Testblock",
                            "targetElements": [
                                "testblock"
                            ],
                            "style": "positive"
                        }
                    ]
                }
            ]
        }
    ]
}

Additional context

No response

t-sperling avatar Jul 06 '23 12:07 t-sperling

@therpertz - Thank you for reporting this. Fortunately, the error isn't blocking and only requires a minor patch. While there is no ETA, this will be considered for a future release.

stevkan avatar Aug 25 '23 20:08 stevkan