microsoft / microsoft/AdaptiveCards
[Rendering] TextRun with selectAction OpenUrlAction inside RichTextBlock
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2k
- Forks
- 595
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 1
Description
Target Platforms
NodeJS
SDK Version
1.3.2
Application Name
Microsoft Teams
Problem Description
Hello,
I am trying to render a card which contains a RichTextBlock with two TextRun with the JavaScript SDK :
- Is a simple text TextRun
- Is a clickable TextRunwith OpenUrlAction as selectAction
Everything is fine while creating my RichTextBlock : when I watch the .toJSON() result I can see my selectAction.
After using AdaptiveCards.addItem and watch the .toJSON() of my AdaptiveCards I don't see the selectAction anymore.
Microsoft Teams is rendering my card but there is not OpenUrlAction on the second TextRun.
It seems like the method .addItem remove selectAction from my TextRun.
Maybe I am not using well the JavaScript SDK ?
Screenshots
RichTextBlock content before .addItem :
Card after adding RichTextBlock with .addItem
Card JSON
Not needed, the card is rendered.
Sample Code Language
TypeScript
Sample Code
const card = new AdaptiveCard();
const richTextBlock = new RichTextBlock();
const textRun1 = new TextRun('first text sample');
textRun1.weight = TextWeight.Bolder;
const textRun2 = new TextRun('second url text sample');
textRun2.weight = TextWeight.Bolder;
textRun2.color = TextColor.Accent;
const openUrlAction = new OpenUrlAction();
openUrlAction.url = "http://sampleurl.com";
textRun2.selectAction = openUrlAction;
richTextBlock.addInline(textRun1);
richTextBlock.addInline(textRun2);
card.addItem(richTextBlock);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AdaptiveCard.addItem and RichTextBlock.addInline entry points, reproducing the supplied TypeScript sample and comparing each toJSON result. Trace where TextRun.selectAction is lost; done means the OpenUrlAction remains in the card JSON and renders as a clickable second TextRun.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100