AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

[MS Teams][Rendering] [Empty Column results in complete rejection of json]

Open scottlovegrove opened this issue 6 years ago • 10 comments

Author or host

Are you an author

If you're an author, who are you sending cards to?

Microsoft Teams

Version of SDK

No SDK

Details

If you have a ColumnSet that includes an empty Column, MS Teams will completely reject the entire json and errors.

{
            "spacing": "extraLarge",
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "width": "auto",
                    "items": [{
                            "type": "ActionSet",
                            "actions": [{
                                    "title": "Sign out",
                                    "style": "destructive",
                                    "type": "Action.Submit",
                                    "data": {
                                        "actionType": "signout"
                                    }
                                }
                            ]
                        }
                    ]
                }, {
                    "type": "Column",
                    "width": "stretch",
                }, {
                    "type": "Column",
                    "width": "auto",
                    "horizontalAlignment": "right",
                    "items": [{
                            "type": "ActionSet",
                            "actions": [{
                                    "title": "Add",
                                    "type": "Action.Submit",
                                    "data": {
                                        "actionType": "add_task",
                                        "timeStamp": "2020-07-03T13:09:57.842000+01:00",
                                        "timeOffset": "+01:00"
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }

Using this card json, Teams will reject it, despite it appearing to be valid json in the designer. The designer will give you this: image

Workaround

Instead of having an actual empty Column, we have had to use an empty textblock in order to get this working

{
    "type": "Column",
    "width": "stretch",
    "items": [
     {
          "type": "TextBlock",
          "text": " "
     }]
}

scottlovegrove avatar Jul 03 '20 15:07 scottlovegrove

@siduppal / @VikrantSingh01 do you have any idea on why Teams would reject empty Columns here again?

shalinijoshi19 avatar Jul 09 '20 19:07 shalinijoshi19

Hi @scottlovegrove. We have acknowledged this issue report. Please continue to follow this issue for updates/progress/questions.

ghost avatar Jul 09 '20 19:07 ghost

@scottlovegrove - We could not reproduce the issue on our side. Could you please check the screen shot below. Are you facing this issue in mobile or desktop. Could you please share more details? image

Nikitha-MSFT avatar Jul 10 '20 05:07 Nikitha-MSFT

@Nikitha-MSFT Hi, we're facing this on desktop, however, based on your screenshot it looks like you are sending a card as a message, so in that case, it appears I need to add that this is when displaying a modal adaptive card when using using TaskModuleTaskInfo.

So this is a screenshot of our card within the teams app image

This card needed to be generated with a non-empty middle column in order for this to work. As soon as I put this to be an actual empty column, I get this image

This is the exact json used when it fails to accept the empty column:

{
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [{
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "items": [{
                            "type": "TextBlock",
                            "text": "Task content",
                            "isSubtle": true,
                            "size": "small"
                        }, {
                            "type": "Input.Text",
                            "id": "content",
                            "placeholder": "What do you want to get done?",
                            "value": "This is some task that I want you to do do, so go add it somewhere"
                        }
                    ]
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "Project",
            "isSubtle": true,
            "size": "small"
        }, {
            "type": "Input.ChoiceSet",
            "id": "project",
            "value": "{\"id\": 1767340601, \"name\": \"Inbox\", \"inbox_project\": true}",
            "choices": [{
                    "title": "Inbox",
                    "value": "{\"id\": 1767340601, \"name\": \"Inbox\", \"inbox_project\": true}"
                }, {
                    "title": "Team Inbox",
                    "value": "{\"id\": 2161683739, \"name\": \"Team Inbox\", \"inbox_project\": false}"
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "Priority",
            "isSubtle": true,
            "size": "small"
        }, {
            "type": "Input.ChoiceSet",
            "id": "priority",
            "value": 4,
            "choices": [{
                    "title": "Priority 1 (Highest)",
                    "value": 1
                }, {
                    "title": "Priority 2",
                    "value": 2
                }, {
                    "title": "Priority 3",
                    "value": 3
                }, {
                    "title": "Priority 4 (Normal)",
                    "value": 4
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "Due date (optional)",
            "isSubtle": true,
            "size": "small"
        }, {
            "type": "Input.ChoiceSet",
            "id": "datestring",
            "choices": [{
                    "title": "No due date",
                    "value": ""
                }, {
                    "title": "Today",
                    "value": "Today"
                }, {
                    "title": "Tomorrow",
                    "value": "Tomorrow"
                }, {
                    "title": "Next workday",
                    "value": "Next workday"
                }, {
                    "title": "Next week",
                    "value": "Next week"
                }
            ]
        }, {
            "spacing": "extraLarge",
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "width": "auto",
                    "items": [{
                            "type": "ActionSet",
                            "actions": [{
                                    "title": "Sign out",
                                    "style": "destructive",
                                    "type": "Action.Submit",
                                    "data": {
                                        "actionType": "signout"
                                    }
                                }
                            ]
                        }
                    ]
                }, {
                    "type": "Column",
                    "width": "stretch"
                }, {
                    "type": "Column",
                    "width": "auto",
                    "horizontalAlignment": "right",
                    "items": [{
                            "type": "ActionSet",
                            "actions": [{
                                    "title": "Add",
                                    "type": "Action.Submit",
                                    "data": {
                                        "actionType": "add_task",
                                        "timeStamp": "2020-07-10T16:16:23.693000+01:00",
                                        "timeOffset": "+01:00"
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}

scottlovegrove avatar Jul 10 '20 15:07 scottlovegrove

@scottlovegrove - I have tried the adaptive card and it is rendering properly. Could you please check the screen shot image

Nikitha-MSFT avatar Jul 14 '20 10:07 Nikitha-MSFT

@Nikitha-MSFT This is beginning to make me wonder if it's not Teams' rendering that is the problem, but the Python Bot Framework library that's causing this then.

Our integration has been built in Python using the Bot Framework, the json I've been providing you is the object we are basically giving to the bot framework SDK, so if that is failing for some reason, that would explain the error we're seeing in Teams.

Is there any way we can confirm this?

scottlovegrove avatar Jul 14 '20 10:07 scottlovegrove

@scottlovegrove I have tried the json you shared above and i could not repro the issue either. I am able to see the card even without adding an Empty textblock. Does the card load when you send it in a normal message? Could you please try doing this with a simple card json of 2 columns? Also how are you invoking this TaskModule? Is it from the Bot or from Message Extension?

Gousia-Begum avatar Jul 16 '20 11:07 Gousia-Begum

Hello @scottlovegrove! We need some additional information from you to process this issue. Please see discussion comments above. Thanks!

ghost avatar Sep 24 '20 06:09 ghost

Sorry for the delay. We're invoking the task from the message extension.

The card behaves as expected if we omit the empty column, it was only when I started adding the empty column that we saw this. Removing that column makes the card display correctly again.

scottlovegrove avatar Sep 24 '20 08:09 scottlovegrove

Thanks @scottlovegrove for following up on this issue. A member of our triage crew will re-engage as soon as possible to follow up. Thanks.

ghost avatar Sep 24 '20 08:09 ghost