Action Card Teams wrap text button

Brass Contributor

hello, I have a bot in teams that sends an action card with options on buttons, the problem is that the texts of the buttons are cut off:

 

rosrene_0-1643344178078.pngrosrene_1-1643344213810.png

hello, I have a bot in teams that sends an action card with options on buttons, the problem is that their texts are cut off as seen in the images

 

I do not use adaptive card because they limit me to only 6 buttons and I require more, on the other hand it does not have the functionality to navigate the options to the sides

I need the text to be complete in several lines or have a tooltip that shows the complete text

 

The code I use to send the action card is:

 

var herocard = new HeroCard();
herocard.Title = answers[0].Answer;

List<CardAction> buttons = new List<CardAction>();
var sortedPrompts = prompts.OrderBy(r => r.DisplayText);
foreach (var items in sortedPrompts)
{
buttons.Add(new CardAction()
{
Type = ActionTypes.MessageBack,
Title = items.DisplayText,
DisplayText = items.DisplayText,
Text = items.DisplayText,
Value = items.DisplayText,
});
}
herocard.Buttons = buttons;

var response = stepContext.Context.Activity.CreateReply();
response.Attachments = new List<Microsoft.Bot.Schema.Attachment>() { herocard.ToAttachment() };
await stepContext.Context.SendActivityAsync(response);

 

I welcome your comments and help.

20 Replies
@rosrene-We are looking into this I will get back to you soon.

@rosrene - We are tried it from our end ,It's working fine for us. Could you please try it once as per given code snippet:-

   public static HeroCard GetHeroCard()
        {
            var heroCard = new HeroCard
            {
                Title = "Hero Card",
                Text = "from text/sms to Skype, Slack, Office 365 mail and other popular services.",
                Buttons = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "Learn More", value: "http://www.devenvexe.com"), new CardAction(ActionTypes.OpenUrl, "C# Corner", value: "http://www.c-sharpcorner.com/members/suthahar-j"), new CardAction(ActionTypes.OpenUrl, "MSDN", value: "https://social.msdn.microsoft.com/profile/j%20suthahar/"), new CardAction(ActionTypes.OpenUrl, "Remove subscription button don't take any action when user pressed enter via ", value: "https://social.msdn.microsoft.com/profile/j%20suthahar/") }
            
        };

            return heroCard;
        }

wrap1.png

Microsoft Teams Version 1.5.00.2567 (64-bit)

Let us know if you have any query.

@Sayali-MSFT 

Hello, try to place the code above and continue in the same way.

The code I used was:

 

  var heroCard = new HeroCard
            {
                Title = "Hero Card",
                Text = "from text/sms to Skype, Slack, Office 365 mail and other popular services.",
                Buttons = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "Learn More", value: "http://www.devenvexe.com"), new CardAction(ActionTypes.OpenUrl, "C# Corner", value: "http://www.c-sharpcorner.com/members/suthahar-j"), new CardAction(ActionTypes.OpenUrl, "MSDN", value: "https://social.msdn.microsoft.com/profile/j%20suthahar/"), new CardAction(ActionTypes.OpenUrl, "Remove subscription button don't take any action when user pressed enter via ", value: "https://social.msdn.microsoft.com/profile/j%20suthahar/") }

            };
            var reply = MessageFactory.Attachment(heroCard.ToAttachment());
            await stepContext.Context.SendActivityAsync(reply, cancellationToken);

 

However, the images and cards look like this:

 

fmolina5656_0-1643751665055.png

 

 

@rosrene - Could you please confirm if your issue has resolved with above suggestion or still looking for any help?
@fmolina5656 - Your issue has resolved with above suggestion or still looking for any help?
hello @Sayali-MSFT, the problem continues in the buttons with long text the text is cut off, as seen in the images. @fmolina5656 is a co-worker and works on the problem too
@fmolina5656 - here as you mention the button text wrapping properly in card. Could you just confirm the card is render as per you expected(Wrap Text) or looking any help?
Hi, the problem is that the text of the button is cut, we want it to be displayed completely by continuing on a second line or showing a tooltip

@rosrene - Using the above code when you hover the mouse on button It will show whole text.Could you check it once?
Microsoft Teams Version 1.5.00.3154 (64-bit)
Tooltip1.png

hello @Sayali-MSFT, my problem continues, I don't see tooltips in the texts that are cut off, the latest version available for download is 1.4.00.35564 I didn't find 1.5.00.3154 to download, could you provide me with a download link?
Thank you
Sorry @Sayali-MSFT, downloaded version 1.5.00.3164 from https://statics.teams.cdn.office.net/production-windows-x64/1.5.00.3154/Teams_windows_x64.exe but still the tooltip does not appear
@rosrene-Have you tried out with above sample which fmolina5656 mention?
@Sayali-MSFT yes, we are testing with the code that you shared with @fmolina5656 and the same version of Teams App but the Tip roll does not appear and the card visually has differences between the image that you sent us and the one that fmolina5656 shared, could you share with us the project of vs that you are publishing to see if we find any difference?

@rosrene- Please have a look at this documents-                                                            1. https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/csharp_dotnetcore/06.using-cards/C...
2. https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/csharp_dotnetcore/50.teams-messagi...
Let us know if you have any query.

@rosrene- Did you get chance to try on the above suggested solution?

Hi @Sayali-MSFT,  

Sorry for the delay, I have been doing several tests and I identified that:

the example provided from the repository https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/csharp_dotnetcore/06.using-cards/C... works correctly and the tooltip is seen in long texts

 

rosrene_0-1644988406480.png

 

in this example the action type is an OpenURL

 

rosrene_1-1644988567795.png

if the action type is changed to messageback which we need, then the tooltip doesn't appear

rosrene_2-1644988750265.png

 

rosrene_3-1644988796889.png

I think that now we have the concrete cause, we need to see how to solve it
Thanks

@Sayali-MSFT hi, any update?

@rosrene - There doesn't seem to be any alternative for this.

@Sayali-MSFT hi, any update?