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

[JS] Filtered ChoiceSet support #6146

Merged
merged 4 commits into from
Aug 2, 2021
Merged

[JS] Filtered ChoiceSet support #6146

merged 4 commits into from
Aug 2, 2021

Conversation

dclaux
Copy link
Member

@dclaux dclaux commented Jul 28, 2021

Related Issue

Fixes #5986

Description

Implements the new "filtered" style on ChoiceSet as defined here: #4713

This implementation uses the standard HTML5 "combobox" feature, namely an <input type="text"> associated with a <datalist>. The caveats of this implementation are:

  • The drop down arrow doesn’t look very good, and there is no way to style it
  • The drop down arrow doesn’t appear in Firefox. You have to click twice inside the edit to see the dropdown
  • This HTML5 feature isn’t supported in Opera on Android
  • The filtering mechanism looks for any match anywhere in the available values. For instance, “two” would match both “Two” and “Network”

NOTES:

  • For validation, the code looks for an a choice whose value is an exact, case sensitive match to the value entered in the input. The spec still lists this topic as an open issue.
  • This PR introduces a minor breaking change in the designer, where the isCompactProperty property on ChoiceSetPeer has been removed and replaced by a styleProperty. It is extremely unlikely any developer will have any issue with this.

Sample Card

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "Input.ChoiceSet",
            "choices": [
                {
                    "title": "Choice 1",
                    "value": "Choice 1"
                },
                {
                    "title": "Choice 2",
                    "value": "Choice 2"
                }
            ],
            "placeholder": "Placeholder text",
            "style": "filtered",
            "label": "Filtered ChoiceSet",
            "isRequired": true,
            "errorMessage": "Error!",
            "id": "abc"
        }
    ],
    "actions": [
        {
            "type": "Action.Submit",
            "title": "Action.Submit"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5"
}

How Verified

Verified manually in adaptivecards-designer-app

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Jul 28, 2021

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.

Copy link
Member

@paulcam206 paulcam206 left a comment

Choose a reason for hiding this comment

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

looks good!

@dclaux dclaux requested a review from paulcam206 July 29, 2021 19:32
@dclaux
Copy link
Member Author

dclaux commented Jul 29, 2021

@paulcam206 thanks for the initial review, may I ask you take a quick look at the newest commit. There was a styling issue (filtered ChoiceSet's height wasn't consistent with other inputs) and I forgot to handle placeholder.

@dclaux dclaux merged commit fe5bd82 into main Aug 2, 2021
@dclaux dclaux deleted the js/filtered-cs branch August 2, 2021 16:22
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
* Filtered ChoiceSet support

* Fix versioning of "filtered" style

* Fix styling and placeholder
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.

[JS] Input.ChoiceSet static filtering
3 participants