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

Input Labels Spec Documents #3618

Merged
merged 6 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update schema and spec to have label on all inputs
  • Loading branch information
Rebecca Muraira committed Dec 4, 2019
commit 276d40bcccc7a4bb614d43cc780a81fe43630985
36 changes: 21 additions & 15 deletions schemas/1.3.0/adaptive-card.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@
"version": "1.2"
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -944,6 +945,7 @@
"description": "The initial value for this field expressed in ISO-8601 format."
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -985,6 +987,7 @@
"description": "Initial value for this field."
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -1014,21 +1017,6 @@
"description": "If `true`, allow multiple lines of input.",
"default": false
},
"label": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/TextBlock"
},
{
"$ref": "#/definitions/RichTextBlock"
}
],
"description": "Label for this input",
"version": "1.3"
},
"maxLength": {
"type": "number",
"description": "Hint of maximum length characters to collect (may be ignored by some clients)."
Expand All @@ -1050,6 +1038,7 @@
"description": "The initial value for this field."
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -1091,6 +1080,7 @@
"description": "The initial value for this field expressed in ISO-8601 format."
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -1140,6 +1130,7 @@
"version": "1.2"
},
"id": {},
"label": {},
"fallback": {},
"height": {},
"separator": {},
Expand Down Expand Up @@ -2401,6 +2392,21 @@
"type": "string",
"description": "Unique identifier for the value. Used to identify collected input when the Submit action is performed."
},
"label": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/TextBlock"
},
{
"$ref": "#/definitions/RichTextBlock"
}
],
"description": "Label for this input",
"version": "1.3"
},
"fallback": {
"anyOf": [
{
Expand Down
5 changes: 0 additions & 5 deletions schemas/src/elements/inputs/Input.Text.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
"description": "If `true`, allow multiple lines of input.",
"default": false
},
"label": {
"type": "string|TextBlock|RichTextBlock",
"description": "Label for this input",
"version": "1.3"
},
"maxLength": {
"type": "number",
"description": "Hint of maximum length characters to collect (may be ignored by some clients)."
Expand Down
32 changes: 19 additions & 13 deletions schemas/src/elements/inputs/Input.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/AdaptiveCards/6f39aedce45864ae1067ed44a5551dc973790bb5/source/nodejs/typed-schema/schema/lib/Type.json",
"extends": "Element",
"isAbstract": true,
"description": "Base input class",
"properties": {
"id": {
"type": "string",
"required": true,
"description": "Unique identifier for the value. Used to identify collected input when the Submit action is performed.",
"override": true
}
}
}
"$schema": "https://raw.githubusercontent.com/microsoft/AdaptiveCards/6f39aedce45864ae1067ed44a5551dc973790bb5/source/nodejs/typed-schema/schema/lib/Type.json",
"extends": "Element",
"isAbstract": true,
"description": "Base input class",
"properties": {
"id": {
"type": "string",
"required": true,
"description": "Unique identifier for the value. Used to identify collected input when the Submit action is performed.",
"override": true
},
"label": {
"type": "string|TextBlock|RichTextBlock",
"description": "Label for this input",
"version": "1.3"
}
}
}

3 changes: 2 additions & 1 deletion specs/DesignDiscussions/InputLabels.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ Our primary input scenario card uses placeholders to label the inputs. With eith
Possible Options:
1. Card author can determine if the label should be put in the placeholder text (`"useLabelAsPlaceholder": true`, `"labelPosition": "Placeholder"`)
- What do we do if they set a non-label placeholder and set useLabelAsPlaceholder to true? (spec who wins - placeholder probably)
- A placeholder with formatting wouldn't make sense, so if they add formatting to their label and then position it as the placeholder that formatting will be lost.
2. Host decides via host-config (`"labelPosition": "Placeholder"`).
- Same issue as above if an explicit placeholder is set by the card author. On option would be to only respect this if no inputs have placeholders (precedent from button icon placement).
- Same issues as above if an explicit placeholder is set by the card author. On option for the case with both a label and a placeholder would be to only respect this if no inputs have placeholders (precedent from button icon placement).
3. Do nothing (in the schema)
- Card author can set placeholder instead of label if they want a placeholder to be the label. Undercuts our ability to reason over the card (we don’t know if the placeholder text is being used as the input’s label) but I’m not sure that has any practical negative consequences:
- Placeholder will serve as accessibility name in the absence of a label
Expand Down
22 changes: 21 additions & 1 deletion specs/elements/Input.ChoiceSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

| Property | Type | Required | Description | Version |
| -------- | ---- | -------- | ----------- | ------- |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **fallback** | `Element`, `FallbackOption` | No | Describes what to do when an unknown element is encountered or the requires of this or any children can't be met. | 1.2 |
| **height** | `BlockElementHeight` | No | Specifies the height of the element. | 1.1 |
| **separator** | `boolean` | No | When `true`, draw a separating line at the top of the element. | 1.0 |
Expand Down Expand Up @@ -43,6 +44,19 @@
* `"expanded"`


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## fallback

Describes what to do when an unknown element is encountered or the requires of this or any children can't be met.
Expand Down Expand Up @@ -97,4 +111,10 @@ Controls the amount of spacing between this element and the preceding element.
* `"padding"`
<!-- END AUTO-GENERATED -->

## Rendering
## Rendering

### Labels
The `label` property should be rendered above the choice set. In the case of a compact choice set, clicking/tapping on the rendered label should put focus on the input.

### Accessibility
The `label` property should be set as the accessibility text for the choice set when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
22 changes: 21 additions & 1 deletion specs/elements/Input.Date.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

| Property | Type | Required | Description | Version |
| -------- | ---- | -------- | ----------- | ------- |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **fallback** | `Element`, `FallbackOption` | No | Describes what to do when an unknown element is encountered or the requires of this or any children can't be met. | 1.2 |
| **height** | `BlockElementHeight` | No | Specifies the height of the element. | 1.1 |
| **separator** | `boolean` | No | When `true`, draw a separating line at the top of the element. | 1.0 |
Expand All @@ -23,6 +24,19 @@
| **requires** | `Dictionary<string>` | No | A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered. | 1.2 |


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## fallback

Describes what to do when an unknown element is encountered or the requires of this or any children can't be met.
Expand Down Expand Up @@ -77,4 +91,10 @@ Controls the amount of spacing between this element and the preceding element.
* `"padding"`
<!-- END AUTO-GENERATED -->

## Rendering
## Rendering

### Labels
The `label` property should be rendered above the input box or date picker. Clicking/tapping on the rendered label should put focus on the input.

### Accessibility
The `label` property should be set as the accessibility text when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
22 changes: 21 additions & 1 deletion specs/elements/Input.Number.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

| Property | Type | Required | Description | Version |
| -------- | ---- | -------- | ----------- | ------- |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **fallback** | `Element`, `FallbackOption` | No | Describes what to do when an unknown element is encountered or the requires of this or any children can't be met. | 1.2 |
| **height** | `BlockElementHeight` | No | Specifies the height of the element. | 1.1 |
| **separator** | `boolean` | No | When `true`, draw a separating line at the top of the element. | 1.0 |
Expand All @@ -23,6 +24,19 @@
| **requires** | `Dictionary<string>` | No | A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered. | 1.2 |


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## fallback

Describes what to do when an unknown element is encountered or the requires of this or any children can't be met.
Expand Down Expand Up @@ -77,4 +91,10 @@ Controls the amount of spacing between this element and the preceding element.
* `"padding"`
<!-- END AUTO-GENERATED -->

## Rendering
## Rendering

### Labels
The `label` property should be rendered above the input box. Clicking/tapping on the rendered label should put focus in the input box.

### Accessibility
The `label` property should be set as the accessibility text when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
32 changes: 16 additions & 16 deletions specs/elements/Input.Text.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
| **type** | `"Input.Text"` | Yes | Must be `"Input.Text"`. | 1.0 |
| **id** | `string` | Yes | Unique identifier for the value. Used to identify collected input when the Submit action is performed. | 1.0 |
| **isMultiline** | `boolean` | No | If `true`, allow multiple lines of input. | 1.0 |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **maxLength** | `number` | No | Hint of maximum length characters to collect (may be ignored by some clients). | 1.0 |
| **placeholder** | `string` | No | Description of the input desired. Displayed when no text has been input. | 1.0 |
| **style** | `TextInputStyle` | No | | 1.0 |
Expand All @@ -18,6 +17,7 @@

| Property | Type | Required | Description | Version |
| -------- | ---- | -------- | ----------- | ------- |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **fallback** | `Element`, `FallbackOption` | No | Describes what to do when an unknown element is encountered or the requires of this or any children can't be met. | 1.2 |
| **height** | `BlockElementHeight` | No | Specifies the height of the element. | 1.1 |
| **separator** | `boolean` | No | When `true`, draw a separating line at the top of the element. | 1.0 |
Expand All @@ -26,19 +26,6 @@
| **requires** | `Dictionary<string>` | No | A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered. | 1.2 |


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## style

* **Type**: `TextInputStyle`
Expand All @@ -63,6 +50,19 @@ The inline action for the input. Typically displayed to the right of the input.
* `Action.ToggleVisibility`


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## fallback

Describes what to do when an unknown element is encountered or the requires of this or any children can't be met.
Expand Down Expand Up @@ -120,7 +120,7 @@ Controls the amount of spacing between this element and the preceding element.
## Rendering

### Labels
The `label` property should be rendered above the input box. Clicking/tapping on the rendered label should put focus on the corresponding input.
The `label` property should be rendered above the input box. Clicking/tapping on the rendered label should put focus in the input box.

### Accessibility
The `label` property should be set as the accessiblity text when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
The `label` property should be set as the accessibility text when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
22 changes: 21 additions & 1 deletion specs/elements/Input.Time.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

| Property | Type | Required | Description | Version |
| -------- | ---- | -------- | ----------- | ------- |
| **label** | `string`, `TextBlock`, `RichTextBlock` | No | Label for this input | 1.3 |
| **fallback** | `Element`, `FallbackOption` | No | Describes what to do when an unknown element is encountered or the requires of this or any children can't be met. | 1.2 |
| **height** | `BlockElementHeight` | No | Specifies the height of the element. | 1.1 |
| **separator** | `boolean` | No | When `true`, draw a separating line at the top of the element. | 1.0 |
Expand All @@ -23,6 +24,19 @@
| **requires** | `Dictionary<string>` | No | A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered. | 1.2 |


## label

Label for this input

* **Type**: `string`, `TextBlock`, `RichTextBlock`
* **Version** : 1.3
* **Required**: No
* **Allowed values**:
* `string`
* `TextBlock`
* `RichTextBlock`


## fallback

Describes what to do when an unknown element is encountered or the requires of this or any children can't be met.
Expand Down Expand Up @@ -77,4 +91,10 @@ Controls the amount of spacing between this element and the preceding element.
* `"padding"`
<!-- END AUTO-GENERATED -->

## Rendering
## Rendering

### Labels
The `label` property should be rendered above the input box or time picker. Clicking/tapping on the rendered label should put focus on the input.

### Accessibility
The `label` property should be set as the accessibility text when present. If the `label` property is not present, the `placeholder` property should be used instead if present.
Loading