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

inlineAction on text boxes #147

Closed
7 tasks done
andrewleader opened this issue Mar 9, 2017 · 17 comments
Closed
7 tasks done

inlineAction on text boxes #147

andrewleader opened this issue Mar 9, 2017 · 17 comments
Labels
Area-Renderers Area-Schema Epic Platform-XAML Bugs or features related to Xaml Renderer Spec

Comments

@andrewleader
Copy link
Contributor

andrewleader commented Mar 9, 2017

Release Renderer status Tasks status
1.2 ✔️ .NET (#1359)
✔️ Android (#1285)
✔️ iOS (#1284)
✔️ TS (#1360)
✔️ UWP (#1283)
✔️ Shared (#1282)
✔️ Designer (#2674)

Solves requests

Example Comps

image

Notice how Android notifications choose to display the button as part of the text input. The payload should allow this flexibility for the host to display the button however makes sense.

image

Spec

Schema Changes

On only Input.Text (since that seems to be the only place a quick action would be desired on an input), the following property would be added...

Property Type Required Description
type Input.Text true
inlineAction Action false The inline action for the input. Typically displayed to the right of the input. Strongly recommended you provide an icon on the action (which will be displayed instead of the title of the action).

Schema example

{
  "type": "Input.Text",
  "id": "comment",
  "placeholder": "enter comment",
  "inlineAction": {
    "type": "Action.Submit",
    "iconUrl": "ms-appx:///Assets/reply.png",
    "title": "Reply"
  }
}

Host Config

Renderer Requirements

  • A renderer must display the inlineAction however the native platform typically displays actions related to a text input. For example, on UWP, should be displayed like the following

image

Android might display like the following...

image

  • If there is an icon on the action, simply use the icon (don't display the text). The title text should be used as a tooltip on the action.
    • The icon should use the same fitting behavior as normal icon actions (if the icon is 100px tall and only 50px wide, it should behave the same here as it does when it's a normal icon action)
  • If there's no icon, display the title instead.

image

  • Inline expansion of Action.ShowCard is NOT supported (since we don't support inline showcards within the body right now). If a show card is present and the host is configured for inline show cards the action will be dropped and a warning will be returned.

  • A renderer must invoke the inlineAction when the user performs the native platform action for submitting a text field...

    • For example...
      • On UWP...
        • For a single line text input, enter will trigger the action (shift-enter and ctrl-enter will be ignored).
        • For a multiline text input, enter will add a newline.
      • On iOS
        • If isMultiline is NOT enabled
          • The virtual keyboard should display the "submit" button and pressing that should submit the button.
        • If isMultiline IS enabled
          • The virtual keyboard should be left as-is (leaving the normal enter button that adds a newline, since otherwise there's no way to add newlines).
  • Renderers must assign a style of InlineAction (or whatever the renderer standard for style names is) to the button so that hosts can natively style the button as they wish

Downlevel Impact

High

This will not be able to render properly, and the card will be unfunctional.

Host impact: Medium. Hosts need to update their native styling to include this new InlineAction button.

Related features

Auto-generated task status

  • Shared
  • Designer
  • .NET
  • Android
  • iOS
  • TS
  • UWP
@dclaux
Copy link
Member

dclaux commented Apr 22, 2017

This is achievable with a ColumnSet with 2 columns; the left one contains the input and has its size property set to stretch, the right one has size = auto and contains the image with its selectAction set.

@andrewleader
Copy link
Contributor Author

Good point. I'll close this, thanks!

@andrewleader
Copy link
Contributor Author

(nvm, will open new issue on ability to associate input with text box for Ctrl+Enter)

@andrewleader
Copy link
Contributor Author

Actually we do have to re-open this. Using two columns with a size = auto on the image column doesn't work, as seen below

image

There's no way to force the image to match the height of the text box. The airplane seen there displays taller than the text box itself.

Maybe we need a size property on the image itself that is "button" or something? Or even better, "squareButton".

@dclaux
Copy link
Member

dclaux commented May 15, 2017

Would the ability to vertically center content in both columns solve the problem?

@andrewleader
Copy link
Contributor Author

Vertically center wouldn't force the image to match the height of the text box. If the image is 200 px tall and the text box is only 80 px tall, you're still going to have 60 px of blank space above and below the text box

@dclaux
Copy link
Member

dclaux commented May 17, 2017

Why not use an image that's as tall as the input then? You control the input's height. Plus you probably don't want a stretched or downsized image anyway?

@andrewleader
Copy link
Contributor Author

How does the card author control the input height? Each card host might have different input heights. We don't want devs needing to provide different images for each host.

Plus, what happens in a future release when a card host decides "My input text boxes are now going to be 90px tall instead of 80px", all existing cards being sent will look incorrect.

Guidance would definitely be "Provide the correct resolution image", but the reality is, that can't be the only solution due to its drawbacks (future app-compat issues being the key drawback).

@dclaux
Copy link
Member

dclaux commented May 17, 2017

The host controls the height of the inputs and the available image sizes. It could be a convention that the "small" image size is the same height as an input, but there is no guarantee.
Also the vertical alignment solution I think could be a decent compromise. Yes, there is no guarantee the image would be the same height as the input, but at least things would be properly aligned.
I'm just trying to find a solution in the confines of the format before jumping to the conclusion we need something new. You have great points; I think we'll have to sit together and discuss.

@andrewleader
Copy link
Contributor Author

I think a new image size, "size": "squareImageButton" might be the most elegant solution. I prototyped it in the UWP renderer, and this is what it looks like

image

      {
        "type": "ColumnSet",
        "columns": [
          {
            "type": "Column",
            "size": "stretch",
            "items": [
              {
                "type": "Input.Text",
                "id": "textInput",
                "placeholder": "reply"
              }
            ]
          },
          {
            "type": "Column",
            "size": "auto",
            "items": [
              {
                "type": "Image",
                "url": "Assets/Icons/send.png",
                "size":  "squareImageButton",
                "selectAction": {
                  "type": "Action.Submit",
                  "title": "Send"
                }
              }
            ]
          }
        ]
      }

Adding the new size allows hosts to still keep small for a different purpose rather than requiring small to match the height of inputs.

@andrewleader andrewleader changed the title Ability to display an action to the right of an input for quick-reply toasts Ability to display an image action to the right of an input for quick-reply toasts Jun 8, 2017
@matthidinger
Copy link
Member

@Anbare would you consider this necessary for v1 to ship notifications?

@andrewleader
Copy link
Contributor Author

andrewleader commented Aug 3, 2017

Without this that would mean the story is: "If you want to make a quick reply message toast, you have to use legacy XML"

Maybe that's an ok story, most of the scenarios that require new Card features like ShowCard and hit targets are all using normal buttons rather than quick reply buttons. But it's definitely not a perfect story.

@andrewleader andrewleader added the Platform-XAML Bugs or features related to Xaml Renderer label Sep 5, 2017
@matthidinger matthidinger added this to the v1.1 milestone Sep 5, 2017
@matthidinger
Copy link
Member

matthidinger commented Sep 5, 2017

What if we add something semantic like quickReplyAction on Input.Text (since that seems to be the only real-world scenario where a quick-reply would be used).

We would also need to get in #389 Action/Image support

 {
      "type": "Input.Text",
      "id": "comment",
      "placeholder": "enter comment",
      "maxLength": 500,
      "isMultiline": false,
      "speak": "What comments do you have?",
      "value": "This is a pre-filled value",
      "defaultAction": {
           "showButton": false,
           "action": { 
               "type": "Action.Submit" 
           }
      }
}

@andrewleader
Copy link
Contributor Author

andrewleader commented Oct 2, 2018

Proposal approved. Open question around vertical alignment as the input grows. Align to the bottom? That's what Windows does.

@andrewleader andrewleader changed the title Ability to display an image action to the right of an input for quick-reply toasts Spec draft: Ability to display an image action to the right of an input for quick-reply toasts Oct 3, 2018
@andrewleader andrewleader changed the title Spec draft: Ability to display an image action to the right of an input for quick-reply toasts Spec draft: inlineAction on text boxes Oct 11, 2018
@khouzam
Copy link

khouzam commented Oct 22, 2018

I think that we'll need an iconSize property as we have in the Icons in Actions fir the renderers that cannot easily calculate the height of the text box (HTML and Typescript).

@andrewleader andrewleader mentioned this issue Feb 20, 2019
13 tasks
@andrewleader andrewleader changed the title Spec draft: inlineAction on text boxes inlineAction on text boxes Feb 20, 2019
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
Labels
Area-Renderers Area-Schema Epic Platform-XAML Bugs or features related to Xaml Renderer Spec
Projects
None yet
Development

No branches or pull requests

4 participants