question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adaptive Card Containser's Style is not Respected

See original GitHub issue

Screenshots

Capture

Version

CDN v4.7.1

Describe the bug

Adding style to the container does not have any effect. For example “style”: “good” is entered in the bellow code but webchat does not set the container background to light green or any color.

Steps to reproduce

  1. Use the provided adaptive card below.
  2. Observe that in webchat the containers’ background color is not set.

Expected behavior

Should set the containers’ background color to “good” light green.

Additional context

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.1",
	"body": [
		{
			"type": "Container",
            "style": "good",
            "bleed": true,
			"items": [
				{
					"type": "TextBlock",
					"text": "Publish Adaptive Card schema",
					"weight": "bolder",
					"size": "medium"
				},
				{
					"type": "ColumnSet",
					"columns": [
						{
							"type": "Column",
							"width": "auto",
							"items": [
								{
									"type": "Image",
									"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
									"size": "small",
									"style": "person"
								}
							]
						},
						{
							"type": "Column",
							"width": "stretch",
							"items": [
								{
									"type": "TextBlock",
									"text": "Matt Hidinger",
									"weight": "bolder",
									"wrap": true
								},
								{
									"type": "TextBlock",
									"spacing": "none",
									"text": "Created {{DATE(2017-02-14T06:08:39Z,SHORT)}}",
									"isSubtle": true,
									"wrap": true
								}
							]
						}
					]
				}
			]
		},
		{
			"type": "Container",
            "style": "good",
            "bleed": true,
			"items": [
				{
					"type": "TextBlock",
					"text": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
					"wrap": true
				},
				{
					"type": "FactSet",
					"facts": [
						{
							"title": "Board:",
							"value": "Adaptive Card"
						},
						{
							"title": "List:",
							"value": "Backlog"
						},
						{
							"title": "Assigned to:",
							"value": "Matt Hidinger"
						},
						{
							"title": "Due date:",
							"value": "Not set"
						}
					]
				}
			]
		}
	],
	"actions": [
		{
			"type": "Action.ShowCard",
			"title": "Set due date",
			"card": {
				"type": "AdaptiveCard",
				"body": [
					{
						"type": "Input.Date",
						"id": "dueDate",
						"title": "Select due date"
					},
					{
						"type": "Input.Text",
						"id": "comment",
						"isMultiline": true,
						"placeholder": "Add a comment"
					}
				],
				"actions": [
				    {
				        "type": "Action.OpenUrl",
						"title": "OK",
						"url": "https://adaptivecards.io"
			        }
				]
			}
		},
		{
			"type": "Action.OpenUrl",
			"title": "View",
			"url": "https://adaptivecards.io"
		}
	]
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tdurnfordcommented, Jan 9, 2020

After looking into this further, this issue is actually unrelated to #2145.

Our default Adaptive Card HostConfig is missing Container Styles. Adding the containerStyles to our adaptiveCardHostConfig resolves this issue. @arman-g In the meantime, you can pass your own adaptiveCardHostConfig as a prop to Web Chat as exemplified in the code snippet below.

Web Chat v4.7.1

const res = await fetch('https://webchat-mockbot.azurewebsites.net/directline/token', { method: 'POST' });
const { token } = await res.json();

const adaptiveCardHostConfig = {
  "spacing": {
    "small": 3,
    "default": 8,
    "medium": 20,
    "large": 30,
    "extraLarge": 40,
    "padding": 10
  },
  "separator": {
    "lineThickness": 1,
    "lineColor": "#EEEEEE"
  },
  "supportsInteractivity": true,
  "fontTypes": {
    "default": {
      "fontFamily": "Calibri, sans-serif",
      "fontSizes": {
        "small": 12,
        "default": 14,
        "medium": 17,
        "large": 21,
        "extraLarge": 26
      },
      "fontWeights": {
        "lighter": 200,
        "default": 400,
        "bolder": 600
      }
    },
    "monospace": {
      "fontFamily": "'Courier New', Courier, monospace",
      "fontSizes": {
        "small": 12,
        "default": 14,
        "medium": 17,
        "large": 21,
        "extraLarge": 26
      },
      "fontWeights": {
        "lighter": 200,
        "default": 400,
        "bolder": 600
      }
    }
  },
  "containerStyles": {
    "default": {
      "backgroundColor": "#FFFFFF",
      "foregroundColors": {
        "default": {
          "default": "#000000",
          "subtle": "#767676"
        },
        "accent": {
          "default": "#0063B1",
          "subtle": "#0063B1"
        },
        "attention": {
          "default": "#FF0000",
          "subtle": "#DDFF0000"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#c3ab23",
          "subtle": "#DDc3ab23"
        }
      }
    },
    "emphasis": {
      "backgroundColor": "#F0F0F0",
      "foregroundColors": {
        "default": {
          "default": "#000000",
          "subtle": "#767676"
        },
        "accent": {
          "default": "#2E89FC",
          "subtle": "#882E89FC"
        },
        "attention": {
          "default": "#FF0000",
          "subtle": "#DDFF0000"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#c3ab23",
          "subtle": "#DDc3ab23"
        }
      }
    },
    "accent": {
      "backgroundColor": "#C7DEF9",
      "foregroundColors": {
        "default": {
          "default": "#333333",
          "subtle": "#EE333333"
        },
        "dark": {
          "default": "#000000",
          "subtle": "#66000000"
        },
        "light": {
          "default": "#FFFFFF",
          "subtle": "#33000000"
        },
        "accent": {
          "default": "#2E89FC",
          "subtle": "#882E89FC"
        },
        "attention": {
          "default": "#cc3300",
          "subtle": "#DDcc3300"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#e69500",
          "subtle": "#DDe69500"
        }
      }
    },
    "good": {
      "backgroundColor": "#CCFFCC",
      "foregroundColors": {
        "default": {
          "default": "#333333",
          "subtle": "#EE333333"
        },
        "dark": {
          "default": "#000000",
          "subtle": "#66000000"
        },
        "light": {
          "default": "#FFFFFF",
          "subtle": "#33000000"
        },
        "accent": {
          "default": "#2E89FC",
          "subtle": "#882E89FC"
        },
        "attention": {
          "default": "#cc3300",
          "subtle": "#DDcc3300"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#e69500",
          "subtle": "#DDe69500"
        }
      }
    },
    "attention": {
      "backgroundColor": "#FFC5B2",
      "foregroundColors": {
        "default": {
          "default": "#333333",
          "subtle": "#EE333333"
        },
        "dark": {
          "default": "#000000",
          "subtle": "#66000000"
        },
        "light": {
          "default": "#FFFFFF",
          "subtle": "#33000000"
        },
        "accent": {
          "default": "#2E89FC",
          "subtle": "#882E89FC"
        },
        "attention": {
          "default": "#cc3300",
          "subtle": "#DDcc3300"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#e69500",
          "subtle": "#DDe69500"
        }
      }
    },
    "warning": {
      "backgroundColor": "#FFE2B2",
      "foregroundColors": {
        "default": {
          "default": "#333333",
          "subtle": "#EE333333"
        },
        "dark": {
          "default": "#000000",
          "subtle": "#66000000"
        },
        "light": {
          "default": "#FFFFFF",
          "subtle": "#33000000"
        },
        "accent": {
          "default": "#2E89FC",
          "subtle": "#882E89FC"
        },
        "attention": {
          "default": "#cc3300",
          "subtle": "#DDcc3300"
        },
        "good": {
          "default": "#54a254",
          "subtle": "#DD54a254"
        },
        "warning": {
          "default": "#e69500",
          "subtle": "#DDe69500"
        }
      }
    }
  },
  "imageSizes": {
    "small": 40,
    "medium": 80,
    "large": 160
  },
  "actions": {
    "maxActions": 100,
    "spacing": "default",
    "buttonSpacing": 8,
    "showCard": {
      "actionMode": "inline",
      "inlineTopMargin": 8
    },
    "actionsOrientation": "vertical",
    "actionAlignment": "stretch"
  },
  "adaptiveCard": {
    "allowCustomStyle": false
  },
  "imageSet": {
    "imageSize": "medium",
    "maxImageHeight": 100
  },
  "factSet": {
    "title": {
      "color": "default",
      "size": "default",
      "isSubtle": false,
      "weight": "bolder",
      "wrap": true,
      "maxWidth": 150
    },
    "value": {
      "color": "default",
      "size": "default",
      "isSubtle": false,
      "weight": "default",
      "wrap": true
    },
    "spacing": 8
  }
};
window.WebChat.renderWebChat(
  {
    adaptiveCardHostConfig,
    directLine: window.WebChat.createDirectLine({ token })
  },
  document.getElementById('webchat')
);

Screenshot

image

0reactions
tdurnfordcommented, Feb 24, 2020

@Tiger519 ‘How to’ questions such as this one are better suited for Stack Overflow. Please feel free to post other questions you have about developing your own features over there so the community at large may help out. If you need help with a Web Chat implementation, you can post a question to the Web Chat tag. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

More bugs with Teams adaptive card containers not
More bugs with Teams adaptive card containers not respecting the container style? Hi all, I have several flows which generate adaptive cards ......
Read more >
Container bleed - Schema Explorer | Adaptive Cards
If no parent container has verticalContentAlignment set, it defaults to Top. ... style. Style hint for Container . Type: ContainerStyle? Required: No ......
Read more >
Image - Schema Explorer | Adaptive Cards
Applies a background to a transparent image. This property will respect the image style. Type: string; Version : 1.1; Required: No. JSON
Read more >
Input.Text - Schema Explorer | Adaptive Cards
Displayed when no text has been input. 1.0. regex, string, No, Regular expression indicating the required format of this text input. 1.3. style...
Read more >
Column - Schema Explorer | Adaptive Cards
style, ContainerStyle? No, Style hint for Column . ... If no parent container has verticalContentAlignment set, it defaults to Top.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found