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 Cards / Platform Discrepancy] Excess spacing in empty text blocks

See original GitHub issue

Web / Desktop

What platform is your issue or question related to? (Delete other platforms).

  • Android
  • iOS
  • JavaScript
  • UWP

#4305 tracks this issue for .NET

Author or host

This is issue seen in the empty text playlod in Adaptive Card.

Version of SDK

1.2.5

Details

For empty text blocks – there is too much spacing rendered on Mobile as compared to Desktop (example in images below). Empty text block elements should not be rendered at all.

JSON for these cards attached

Desktop: image

Mobile: image

This issues in see in empty text block in Adaptive Card.

Payload :

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "Container",
      "items": [
          {
          "type": "TextBlock",
          "text": "before"
        },
        {
          "type": "TextBlock",
          "text": ""
        },
        {
          "type": "TextBlock",
          "text": ""
        },
        {
          "type": "TextBlock",
          "text": "after"
        },
        {
          "type": "Image",
          "url": "http://adaptivecards.io/content/cats/1.png"
        }
      ]
    }
  ]
}

Input from @Susan Shen :

@Vikrant Singh Checked the SDK code and I’m seeing that if the text is an empty string, the SDK renderer returns null for the object, and therefore, the TextBlock is not rendered. The behavior in Web/Desktop holds in the Adaptive Card Designer as well - you can use the same payload and then select Preview Mode to see that there’s no spacing between the before and after.

I think the overall behavior should be that if the developer wants to display an empty text block, they can create one by setting the text to " " (one space) instead of an empty string.

This look like a discrepancy where for Desktop client A.C SDK Returns the null instance instead of a new line for empty strings?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
susanshen96commented, Mar 19, 2020

@shalinijoshi19 - I can only speak for Web/Desktop - the current behavior on Web/Desktop Teams is that if a TextBlock does not have any text (empty text), the TextBlock is not rendered - this seems to be the expected behavior, as the AC Designer does not render an TextBlock without empty text. The TextBlock would only render with a single whitespace, or more characters.

AFAIK, there isn’t a scenario for which we’d want TextBlocks with empty text to be rendered. This is happening on mobile, though, and it’s something we’d want to correct so that the behavior on Mobile aligns with current Web/Desktop behavior.

cc: @siduppal / @VikrantSingh01

1reaction
paulcam206commented, Jan 8, 2020

This is actually a duplicate of the (very old) #641. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

MS Teams Adaptive Card Design (the extra padding space ...
Hi team, I'm using the MS Graph API Explorer to send messages to Channels in Teams, but whenever I send a message with...
Read more >
[Teams][botbuilder] Empty lines in Adaptive Cards TextBlock
I was able to do it in https://adaptivecards.io/designer/ with \n \n\n But when I send it from my bot service, MS Teams is displaying...
Read more >
adaptivecard
This function is intended for processing text for use in an Adaptive Card TextBlock element. The goal is to provide spacing in rendered...
Read more >
RichTextBlock
Defines an array of inlines, allowing for inline text formatting. ... spacing, Spacing, No, Controls the amount of spacing between this element and...
Read more >
Adaptive Cards Line Break
Text content of a div skip the line in adaptive card. I'm trying to change the web chat appearance of botframework. Out of...
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