Support inline expansion of Action.ShowCard in SelectAction
| Release | Renderer status | Tasks status |
|---|---|---|
| Not scheduled | ✔️ .NET (#1558) |
Problem
When using Action.ShowCard within a selectAction, inline expansion doesn't work.
Implementation status
- [ ] TypeScript
- [ ] UWP
- [x] .NET
- [ ] iOS
- [ ] Android
- [ ] Documentation
Auto-generated task status
- [x] .NET
@dclaux could you please elaborate on this one with screenshots or schema proposals? Feel free to add whatever labels you feel necessary to track it
Currently on selectAction, Action.ShowCard doesn't work well, only Action.OpenUrl and Action.Submit works. I'd love to have Action.ShowCard work as a container action as well.
I think there is a better way to do this. Action.ShowCard should be supported as a selectAction, but I think it should always popup, because there is simply no good way for the renderer to know where to expand the inline card.
For inline expansion, the right solution IMO is Action.ToggleVisibility as described in this issue: https://github.com/Microsoft/AdaptiveCards/issues/495
Action.ToggleVisibility is available via the Outlook container in the visualizer if you build from master (I don't believe the official visualizer is up to date yet), and it supports toggling the visibility of multiple elements as @anbare's suggestion.
I think if Action.ShowCard is going to work, there has to be a restriction in how it can be used. Perhaps that is one additional card at a time, and then you have Action.ShowCard .Before & Action.ShowCard .After This would work for both Vertically and Horizontally laid out cards in a list. Cards shown on their own, could have a parent property for its orientation, which would inform the renderer where to create the additional cards.
I really don't think we can make Action.ShowCard inline expansion "just work" outside the context of the actions collection of a card. The problem is the selectAction could be set anywhere within a card, including on column that might be in a container that could itself be in another column... The renderer really needs to know where within the overall card the inline expansion needs to happen, and IMO that is only really possible if that piece of information is provided by the card author. And that's what Action.ToggleVisibility is meant to enable.
The way I'm imaging Action.ShowCard to work on selectAction is as if we're using ActionSet with a showcard on a container, when clicked, it's going to show the card right underneath the container.
I'm trying to understand the user experience of a series of inline showcards if allowed to be on any container. The problem I have is that the user flow is moving from card to card and the potential is that any other elements below the inline container showcard may not then be in context with where the user has navigated to in a showcard series.
Is there really a need for it to be a showcard inline to a container? I would suspect with a visibility toggle on an element, it would be used by authors as a "pop up" type context, rather than a new context that an entire showcard brings.
Is there a specific use case that I haven't considered where an inline showcard is required?
If Action.ToggleVisibility is available, I think it replaces the need for inline Action.ShowCard, but either way, the UX impact is up to the author of the card, and in both scenarios, the author can mess up layout if those actions are not used carefully.
Absolutely true.
What I am trying to consider is the "logic" of the conversation as an interaction, not necessarily the layout.
Consider the following:
{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Root Card","maxLines":1},{"type":"Input.Text","placeholder":"placeholder","value":"ValueRoot","style":"text","maxLength":250,"id":"0bfac05c-9a22-4286-83a7-ec929d595a5d"}],"actions":[{"type":"Action.ShowCard","card":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Show Card 1","maxLines":1},{"type":"Input.Text","placeholder":"placeholder","value":"Value1","style":"text","maxLength":250,"id":"3fac5a6b-8ead-4c01-9f7a-c5a8be800453"}],"actions":[{"type":"Action.ShowCard","card":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Show Card 2","maxLines":1},{"type":"Input.Text","placeholder":"placeholder","value":"Value2","style":"text","maxLength":250,"id":"9d39a2bc-f757-4821-b29c-81cc03d4f336"}],"actions":[{"type":"Action.ShowCard","card":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Show Card 3","maxLines":1},{"type":"Input.Text","placeholder":"placeholder","value":"Value3","style":"text","maxLength":250,"id":"aceeed40-e451-4156-b34a-0ea7084ab274"}],"actions":[{"type":"Action.Submit","data":"","title":"Show Me"}]},"title":"Open Show Card 3"},{"type":"Action.ShowCard","card":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Show Card 4","maxLines":1},{"type":"Input.Text","placeholder":"placeholder","value":"Value4","style":"text","maxLength":250,"id":"91f887cf-330f-4f40-8b90-20e65953b777"}],"actions":[{"type":"Action.Submit","data":"","title":"Show Values"}]},"title":"Open Show Card 4"}]},"title":"Open Show Card 2"}]},"title":"Open Show Card 1"}]}
Because the ShowCard(s) are contained within the context of the conversational flow, the values returned are in context. If there were additional input elements in the root card - after a container with a showcard - then I assume the data on submit would also contain that "dangling" additional root input item?
I'm sure someone will have a valid reason for wanting an entire card object inside a container, but for my mind I see it adding complications to not just rendering, but the authors underlying objects in terms of validation and context separation etc.
Apologies if I am missing the point that others are trying to make. I agree with @zhouk
Not currently under consideration, but will reactivate should we decide to pursue.