microsoft / microsoft/BotFramework-WebChat

Action.ToggleVisibility in Web Chat creates console.log error

Open
#4,761 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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.

Research direction

Start with packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx around the linked error-handling lines. Reproduce the issue using the provided Adaptive Card JSON and the JavaScript Web Chat integration, then verify that Action.ToggleVisibility still toggles the target while no longer printing the unknown-action error or action object to the console.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.