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

[Designer] Remove focus from card elements #7580

Merged

Conversation

anna-dingler
Copy link
Contributor

@anna-dingler anna-dingler commented Jun 28, 2022

Related Issue

Progress towards #7436

Description

Focus should land on designer peers instead of the card elements themselves.

We need to set tabIndex= -1 based on whether or not the user is in design mode. The change was made for elements that still need access to focus when in preview mode (input elements and actions).

Sample Card

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "Input.Text",
            "placeholder": "Placeholder text"
        },
        {
            "type": "Input.Date"
        },
        {
            "type": "Input.Time"
        },
        {
            "type": "Input.Number",
            "placeholder": "Placeholder text"
        },
        {
            "type": "Input.ChoiceSet",
            "choices": [
                {
                    "title": "Choice 1",
                    "value": "Choice 1"
                },
                {
                    "title": "Choice 2",
                    "value": "Choice 2"
                }
            ],
            "placeholder": "Placeholder text"
        },
        {
            "type": "Input.Toggle",
            "title": "New Input.Toggle"
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.OpenUrl",
                    "title": "Action.OpenUrl"
                },
                {
                    "type": "Action.Submit",
                    "title": "Action.Submit"
                },
                {
                    "type": "Action.ShowCard",
                    "title": "Action.ShowCard",
                    "card": {
                        "type": "AdaptiveCard"
                    }
                },
                {
                    "type": "Action.ToggleVisibility",
                    "title": "Action.ToggleVisibility"
                },
                {
                    "type": "Action.Execute",
                    "title": "Action.Execute"
                }
            ]
        }
    ]
}

How Verified

Verified manually on the adaptivecards site.

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Jun 28, 2022

Hi @anna-dingler. 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
Contributor

@beervoley beervoley left a comment

Choose a reason for hiding this comment

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

:shipit:

@anna-dingler anna-dingler merged commit 614f324 into microsoft:main Jul 6, 2022
@anna-dingler anna-dingler deleted the removeFocusFromCardElements branch July 6, 2022 20:13
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
* Remove focus from elements in design mode

* Remove extra tabIndex assignment

* Add isDesignMode() method
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.

None yet

5 participants