-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability for renderers to toggle the visibility of rendered elements #495
Comments
Would we want targetElementId to actually be an array of ids? A.k.a would any scenarios need to toggle the visibility of multiple separate elements? Or is just one id enough? Feels like there'll be requests to toggle multiple, although I haven't thought through the scenarios to know for sure. |
That would make it possible to toggle the visibility of non-contiguous elements, and I am not sure that's desirable. The target scenario really is "show more details" and it seems to me it's better if we constrain to making it possible to show/hide a single element. Plus I think that if we do see an array of Ids is desirable in the future we could definitely support it as well; I would however start with a single Id. |
True and great example. Unfortunately this feature is a hard sell already, and I fear making it even more powerful will make it even harder. |
Was a decision made about toggling one vs multiple ids? |
At this stage it looks like the only thing we'll actually do will be to add the isVisible property and an API in renderers to get an element by Id. With that, Action.ToggleVisibility can be achieved via extensibility, and at that point the decision to support multiple target element Ids or not belongs to the host. |
The issue has been updated to only call for renderers to have the ability to toggle the visibility of rendererd elements at runtime. With what's proposed in this issue, Action.ToggleVisibility can be implemented through extensibility. The issue was discussed and approved today. |
Implementation status
Problem
Multiple scenarios call for dynamically showing/hiding areas of a card as the user clicks a button. Currently, the closest way to do this is by using Action.ShowCard. However, Action.ShowCard is tied to an action set (be it an explicit ActionSet or the actions collection of a card) which make it impossible, for instance, to toggle the visibility of a portion of the card via a Container's selectAction.
Design
All renderers should make it possible to do the following:
In turn, the above capabilities make it possible for hosts to implement a custom Action.ToggleVisibility action that can be used as the selectAction on a container (for instance) to toggle the visibility of one or more elements in the card.
This issue doesn't call for any specific way the above capabilities should be exposed in the various renderers. What matter is that the capabilities exist.
In the TypeScript HTML renderer however, they will be exposed as follows:
The text was updated successfully, but these errors were encountered: