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

[TS] Input.Number bug fixes #5093

Merged
merged 4 commits into from
Nov 18, 2020
Merged

[TS] Input.Number bug fixes #5093

merged 4 commits into from
Nov 18, 2020

Conversation

dclaux
Copy link
Member

@dclaux dclaux commented Nov 18, 2020

Related Issue

Fixes #5092

Description

When min or max where set to 0 in the AC payload, the code would treat them as undefined and thus not stamp them onto the generated <input> tag. This was due to the use of statements like if (!min) which returns true whether min is undefined or equal to 0.

Sample Card

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3",
    "body": [
        {
            "type": "Input.Number",
            "placeholder": "Placeholder text",
            "min": 0,
            "isRequired": true,
            "errorMessage": "Error",
            "id": "dss"
        }
    ],
    "actions": [
        {
            "type": "Action.Submit",
            "title": "Action.Submit"
        }
    ]
}

How Verified

Verified manually in adaptivecards-designer-app

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Nov 18, 2020

Hi @dclaux. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

@@ -3345,11 +3345,11 @@ export class NumberInput extends Input {
this._numberInputElement = document.createElement("input");
this._numberInputElement.setAttribute("type", "number");

if (this.min) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature request for typescript: this should compile down to a null/undefined check. Truthy/falsy values only cause pain, with very little gain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JavaScript][Extensibility] [Min/max limit not set on number input]
2 participants