Skip to content
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

ActionSet element type to render actions anywhere #877

Closed
6 tasks done
matthidinger opened this issue Nov 2, 2017 · 18 comments
Closed
6 tasks done

ActionSet element type to render actions anywhere #877

matthidinger opened this issue Nov 2, 2017 · 18 comments

Comments

@matthidinger
Copy link
Member

matthidinger commented Nov 2, 2017

Release Renderer status Tasks status
1.2 ✔️ .NET (#2438)
✔️ Android (#2439)
✔️ iOS (#2440)
✔️ TS (#2441)
✔️ UWP (#2225)
✔️ Shared (#2437)

Solves requests

Summary

Allow authors to place an "action bar" (or multiple) anywhere within the card body, by introducing an ActionSet element, which takes an array of actions.

This is rendered identically to the existing actions bar - meaning the host gets to choose the button orientation (horizontal/vertical) and alignment (left/center/right/stretch). This lets authors create the cards they want, while still achieving that host consistency of how the buttons are oriented and aligned.

Note that the maxActions from host config is also enforced. The maxActions only apply to a single ActionSet... so if you have two ActionSets and maxActions is 5, you can have 10 buttons on your card.

Schema

New element, ActionSet

Property Type Required Description
type "ActionSet" Yes The type of the element
id string No A unique identifier associated with the element.
spacing string No Controls the amount of spacing between this element and the preceding element.
separator bool No When true, draw a separating line at the top of the element.
actions Action[] Yes The actions to be displayed.
horizontalAlignment string No Does NOT have horizontalAlignment property, since it wouldn't do anything, since hosts get to pick the alignment of buttons. If an author wanted to force the buttons to the left, they could place it in a ColumnSet.

Example

...
                {
                    "type": "ActionSet",
                    "actions": [
                        {
                            "type": "Action.OpenUrl",
                            "title": "Set due date",
                            "url": "https://msn.com"
                        },
                        {
                            "type": "Action.OpenUrl",
                            "title": "View",
                            "url": "https://msn.com"
                        }
                    ]
                },
                {
                    "type": "FactSet",
                    "facts": [
                        {
                            "title": "Board:",
                            "value": "Adaptive Card"
                        },
                        {
                            "title": "List:",
                            "value": "Backlog"
                        },
                        {
                            "title": "Assigned to:",
                            "value": "Matt Hidinger"
                        },
                        {
                            "title": "Due date:",
                            "value": "Not set"
                        }
                    ]
                }

Examples with different host configs. Note that author doesn't get to control the alignment.

Host config Example
Horizontal, stretch image
Horizontal, left image
Vertical, center image
Vertical, right image

Host Config

No changes.

Down-level impact

Medium. ActionSet will be dropped.

Host burden

Theoretically no burden.

Renderer requirements

  • A renderer MUST render the ActionSet using everything from the actions HostConfig except the spacing (the author picks the spacing).
    • Apply the maxActions limit independently to each ActionSet
    • Use the buttonSpacing between buttons
    • Respect the showCard host settings
    • Use the actionsOrientation and actionAlignment
  • A renderer MUST treat ShowCards as follows...
    • Each individual ActionSet behaves independently of others. Thus, if there are 2 ActionSets (and the bottom action bar), each of these three can all have a ShowCard visible at once. Interacting with ShowCards on one ActionSet does NOT cause a different ActionSet's ShowCard to disappear.
  • (More requirements needed, not complete list)

Auto-generated task status

  • Shared
  • .NET
  • Android
  • iOS
  • TS
  • UWP
@matthidinger
Copy link
Member Author

Dupe of #743

@sahar922
Copy link

sahar922 commented Feb 7, 2018

Hi @matthidinger ,
Why did you decide to remove it? why not keep the option to use it, and let the developer decide?
My current chatbot is built on this ActionSet, which is totally legit need in the chatbot world.

Can you please consider bringing it back?

@yaronism
Copy link

yaronism commented Feb 7, 2018

Hi @matthidinger,

We are using MSBF and using this capability with one of our customers which is production. Out of a sudden you decided to remove this feature and their chatbot stopped functioning due to this unilateral decision. Please bring it back ASAP. You can mark it as deprecated but please don't just exclude things which were part from the product before.

@matthidinger
Copy link
Member Author

matthidinger commented Feb 7, 2018

Hi folks, I sincerely apologize for the troubles. We removed ActionSet after feedback from host apps that did not want card authors to be able to put actions anywhere inside the card (they wanted to ensure that all actions were at the bottom of the card).

Therefore we were in a tough spot in that keeping it would have immediately fragmented the ecosystem by setting a precedent that some elements may not be supported everywhere, so for v1.0 we went conservative and opted for consistency in the schema over flexibility.

I'd be happy to keep this discussion going, but in the meantime you should be able to work around this, by registering your own custom ActionSet element and rendering it yourselves using the APIs we provide in the renders. See the bottom of this page for details.

There may also be another workaround if you only need the JavaScript rendererer: @dclaux I know you offer support for this in your client, can you explain if there's a way to toggle ActionSet support in the JS renderer as-is?

@matthidinger matthidinger reopened this Feb 7, 2018
@microsoft microsoft deleted a comment Feb 7, 2018
@dclaux
Copy link
Member

dclaux commented Feb 7, 2018

For folks using the TypeScript renderer (as in rendering cards using the TypeScript renderer in your own application, not sending cards to clients that use the TypeScript renderer to render them) you can already enable support for ActionSet using this one liner:

AdaptiveCard.elementTypeRegistry.registerType("ActionSet", () => { return new Adaptive.ActionSet(); });

@amotzhoshen
Copy link

Thanks @dclaux ,
Do you have a suggestion how to enable it in MSFT BotFramework-WebChat client?

@matthidinger
Copy link
Member Author

@compulim do you have any documentation here on registering custom elements in WebChat?

@sahar922
Copy link

sahar922 commented Feb 8, 2018

@matthidinger suddenly the ActionSet is working again.
Did you make any updates?

@szul
Copy link

szul commented May 19, 2018

I see ActionSet available in the Outlook documentation as of May 7th, but the Visual Studio Code extension doesn't support it, and neither does the Visualizer on the web site.

The problem I'm having is that to create vertically oriented button sets, it seems that I have to edit the host config (a global change), or rely completely on the host rendering.

@dclaux
Copy link
Member

dclaux commented May 19, 2018

@szul the visualizer does support ActionSet when the selected host is Outlook Actionable Messages. The designer also supports it when Outlook is selected as the host.

@szul
Copy link

szul commented May 19, 2018

@dclaux So this is Outlook exclusive then?

@dclaux
Copy link
Member

dclaux commented May 19, 2018

Yes, and documented as such in the Outlook documentation:
image

Not to say that ActionSet will never be supported outside of Outlook, but at the moment it is Outlook specific.

@szul
Copy link

szul commented May 19, 2018

@dclaux So at this time, the only way to make actionable buttons appear in a vertical orientation for all hosts is to edit the host configuration file, correct?

@dclaux
Copy link
Member

dclaux commented May 19, 2018

@szul Correct.

@ignacionr
Copy link
Contributor

ignacionr commented May 20, 2018

From the perspective of a host product intended to receive content from many different providers, I strongly believe that Adaptive Cards should (as @matthidinger put it) keep "semantics" rather than aim at "pixel perfect."
As much as that statement can be kept as a core value, Adaptive Cards can find a great user base.
Sorry to add my 2cents but if you were to start adding a lot of presentation-related features, that would threaten the arguments I am using for my internal sale of the concept.

@microsoft microsoft deleted a comment Oct 1, 2018
@microsoft microsoft deleted a comment Oct 1, 2018
@andrewleader andrewleader changed the title ActionSet element type to render actions anywhere Proposal: ActionSet element type to render actions anywhere Oct 11, 2018
@matthidinger
Copy link
Member Author

Notes from 11/6 review: in the future we will probably add additional styles of actions, like overflow/popup, etc

style="expandedFill"
style="expandedLeft"
style="compact" // overflow

@andrewleader andrewleader changed the title Proposal: ActionSet element type to render actions anywhere Spec draft: ActionSet element type to render actions anywhere Nov 6, 2018
@andrewleader
Copy link
Contributor

Proposal approved!

@shalinijoshi19
Copy link
Member

Closing the issue. Documentation for 1.2 is being tracked separately.

paulcam206 added a commit that referenced this issue May 23, 2019
andrewleader added a commit that referenced this issue Jun 7, 2019
* Create Image.md

* Update Image.md

* Update Image.md

* More specs

* Media element

* Trying to get auto generate working

* Closer!

* [Schema] Document data URI

Feature spec #628

* [Schema] Introduce inlineAction

Original spec #147

* Specs auto-generated!

* [Schema] Add ActionSet

Spec #877

* Include marked-schema locally

* Improve formatting of markdown table

* [Schema] Update version description

Make description for version attribute a little more clear about being required for toplevel cards.

Fixes #2958

* [Schema] Add fontType to TextBlock

Spec #1078

* [Schema] Add wrap to ChoiceSet and Toggle

Spec #1887

* Move spec generation to separate module

* Standalone spec generator script

* Auto-update specs on save

* Add some readme's

* Spec updating readme

* Point people to the readme

* 1.2 features

* Move Adaptive Card rendering into the actual spec file

* Started adding action specs

* Generate host config

* More action info

* More ActionSet details

* Mock renderer statuses

* Finished with actions

* Columns

* Start adding backgroundImage

* Started working on schema-with-types

* Testing infrastructure

* Add URI support

* Add required support

* Refactor to class

* Add type references

* Add extending classes

* Add inehritance with referencing base class

* Support multiple types for single property

* Add arrays

* Add tests for arrays of base types

* Add dictionary support

* Generate typed schema schema from typed schema itself

* Add typed schema schema

* Add booleans

* Disallow additional properties

* Add extends and schema to json schema

* Started updating some of the schema

* Support multiple top-level types and other fixes

* Fix not being able to add properties to extended classes

* Add ability to change property name of type property

* Support having a default type that doesn't need type specified

* New classType schema

* Add ContainerStyle enum

* Add VerticalContentAlignment

* Support default and required in schema

* Support any object type

* Update schemas

* Add nullable

* Add any arrays

* Update schemas

* Add shorthands

* Start writing more schema

* Allow type to not be specified at top level

* Infer type names from file name

* Add more schema

* Add marker interfaces

* More elements

* Support recursive directories

* Rename to typed-schema

* Report more useful errors

* Start generating Adaptive Card schema

* Support enums

* Schema starting to work!

* Fix incorrect container property

* Fix extended classes not allowing extended properties

* Rename to src folder

* Adding columns

* Closer to multiple tiers of extending

* Support multiple inheritance

* Throw errors on unknown types

* Rename to BlockElement

* Add FactSet

* Add ImageSet

* Add Input.Text

* Added all inputs

* Add typed classes for the parser

* Create overall Schema type object

* Support loading schema from folder

* Almost got spec generation working with new format!

* Add ActionSet

* Markdown generation is getting there!

* Markdown generation almost done

* Generate enum specs

* Add enum value description support

* Add shorthand property to classes

* Update schema to support shorthand

* Update schema file

* Include lib

* Updated schema

* Add RichTextBlock

* Re-organize

* Change image uris to strings for relative urls

* Add Style property to Card

* Add Action.ToggleVisibility

* Add style to actions

* Remove duplicative BlockElement properties

* Add fallback

* Update wrap property on inputs

* Generated

* Update Input.Text selectAction

* Generate

* Add some versions

* Fix blank allOf

* Added a test that tests our samples

* Add horizontalAlignment to richtextblock

* Add minHeight

* Add minHeight to AdaptiveCard

* Add isVisible

* Update package-lock.json

* Add verticalContentAlignment to Adaptive Card

* Add height to container and columnset

* Add height to Column

* Add height to all elements

* Support overriding properties

* Fix image height property

* Fix overriding of inherited properties

* Update adaptive-card-new.json

* Make Column.items not required

* All samples valid

* Use uri-reference

* Support allowAdditionalProperties

* Allow custom enums

* card.style version = 1.2

* Include build-model

* Correctly display version number in markdown

* Support shorthands in markdown and fix background image version

* Remove generate-specs from website

* Generating site from new schema partially working

* Site generating properties

* Fix schema literals in website properties

* Make inherited detailed properties appear, and fix examples for properties

* Make type appear correctly on markdown tables

* Update toc

* Add new elements

* Re-order version property

* Show type type in type

* Support displaying enum value versions

* Style the default value correctly

* Indicate that type on inlines is required

* Support inline shorthand

* Improve image size documentation

* Fix inlineAction description

* Surface required properties at top of table

* Remove local marked-schema

* Rename BlockElement to Element

* Dispaly uri-reference as uri

* Rename fonttype sample

* Add expense report example

* Update schema file in sample

* Update ExpenseReport to use Submit

* Support case insensitive enums

* Remove generated adaptive card schema

* Make release build schema

* Remove compiled typed-script schema

* Add instruction for generating Adaptive schema

* Remove spec-generator

* Update samples schema test to use correct payload

* Remove specs

* Support multiple schema versions

* UWP test updates for renamed FontType test

* Typo in UWP test app

* Update UWP tests after sample payloads changed

* Add FontType expected tests

* Add readme for schema

* Update Visualizer to reference new schema file and all samples

* Fix iOS referencing old FontTypes payload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants