cmdpal: Support Enter key to submit FormContent (Adaptive Card) inputs#48768
Draft
michaeljolley wants to merge 1 commit into
Draft
cmdpal: Support Enter key to submit FormContent (Adaptive Card) inputs#48768michaeljolley wants to merge 1 commit into
michaeljolley wants to merge 1 commit into
Conversation
When a user presses Enter inside a single-line TextBox within an Adaptive Card form, find the first Submit or Execute action on the card and trigger form submission with the current input values. This enables keyboard-only form workflows (e.g. login/unlock forms in extensions) without requiring users to click the submit button. Multiline text inputs (AcceptsReturn=true) are excluded so that Enter still inserts newlines in those fields. Fixes #46003 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Enter key support for submitting Adaptive Card forms in the Command Palette. When a user presses Enter inside a single-line
Input.Textfield, the form is automatically submitted using the firstAction.SubmitorAction.Executeaction on the card.Problem
When extensions use
FormContentwith Adaptive Cards, pressing Enter inside anInput.Textfield does not trigger submission. Users must click the submit button with their mouse (or tab to it), breaking keyboard-only workflows like login/unlock forms.Solution
Added a
KeyDownevent handler on the rendered Adaptive Card'sFrameworkElementinContentFormControl.xaml.cs:VirtualKey.Enterwhen the source is aTextBoxthat doesn't accept returns (single-line)AdaptiveSubmitActionorAdaptiveExecuteActionon the cardHandleSubmitwith that action and the current user inputs viaRenderedAdaptiveCard.UserInputs.AsJson()Multiline text inputs (
AcceptsReturn = true) are excluded so Enter still inserts newlines.Validation
ContentFormControl.xaml.csHandleSubmitpath — same behavior as clicking the submit buttonFixes #46003