Adaptivecards: [Adaptive Cards / Platform Discrepancy] Excess spacing in empty text blocks

Created on 7 Jan 2020  Â·  17Comments  Â·  Source: microsoft/AdaptiveCards

Web / Desktop

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

  • [x] Android
  • [x] iOS
  • [x] JavaScript
  • [x] 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?

AdaptiveCards v1.2.10 AdaptiveCards v20.06 Area-Inconsistency Area-Renderers Bug Msft-TeamsMobile MsftTeams-Integration Platform-Android Platform-UWP Platform-iOS Priority-Urgent Triage-Approved for Fix

All 17 comments

Thanks for reporting @VikrantSingh01 . @nesalang another inconsistency issue reported. Could you help take a look! Thanks!

We have triaged this issue report. Please continue to follow the issue for updates/progress/questions. @matthidinger / @dclaux / @rebeccaanne / @paulcam206 FYI.

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

@nesalang to check if " " (with one space) works across the board as possible workaround for now.

If the workaround works this could be a possible workaround else would be "now" in priority. For now keeping "normal" priority.

@nesalang / @shalinijoshi19 : We may need this fix in 1.2.6. Alternatively, if there is a consistent workaround which works in all platform, It would be great to know (for short term).

@paulcam206 can you help out with this one real quck? Is there a short term workaround we can provide Teams Mobile? Load balancing to you

@shalinijoshi19 -- we'll need to decide what the correct behavior should be. in the meantime, I'll check to see if there's a workaround we can supply :)

@vikrantsingh01 @paulcam206 confirmed that the single whitespace workaround doesnt work consistently across platforms at this point. While we investigate on an approach that we can land at least for 1.2.7 (Feb patch) heads up that this may not land by our target code complete (today) on time for a 1.2.6 release for 1/31. Could you explain what the driving Teams scenario for this specific case (empty text for textblock) is?

@siduppal / @susanshen96 : Can you help @shalinijoshi19 / @paulcam206 with more detail which is asked here.

@nesalang forward e-mail discussion to @shalinijoshi19, @susanshen96

@siduppal / @susanshen96 what is the scenario where Teams would like to include empty text for textblocks again?

@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

Using this to track and closing out #641

@golddove / @RebeccaAnne as we fix mobile behavior can we take the time with this investigation to ensure we are doing the same consistent thing on UWP + .NET renderers also?

Closing this out at this point.

Was this page helpful?
0 / 5 - 0 ratings