Skip to content

cmdpal: Support Enter key to submit FormContent (Adaptive Card) inputs#48768

Draft
michaeljolley wants to merge 1 commit into
mainfrom
michaeljolley-cmdpal-enter-submit-form
Draft

cmdpal: Support Enter key to submit FormContent (Adaptive Card) inputs#48768
michaeljolley wants to merge 1 commit into
mainfrom
michaeljolley-cmdpal-enter-submit-form

Conversation

@michaeljolley

Copy link
Copy Markdown
Contributor

Summary

Adds Enter key support for submitting Adaptive Card forms in the Command Palette. When a user presses Enter inside a single-line Input.Text field, the form is automatically submitted using the first Action.Submit or Action.Execute action on the card.

Problem

When extensions use FormContent with Adaptive Cards, pressing Enter inside an Input.Text field 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 KeyDown event handler on the rendered Adaptive Card's FrameworkElement in ContentFormControl.xaml.cs:

  • Intercepts VirtualKey.Enter when the source is a TextBox that doesn't accept returns (single-line)
  • Finds the first AdaptiveSubmitAction or AdaptiveExecuteAction on the card
  • Calls HandleSubmit with that action and the current user inputs via RenderedAdaptiveCard.UserInputs.AsJson()

Multiline text inputs (AcceptsReturn = true) are excluded so Enter still inserts newlines.

Validation

  • Single file change in ContentFormControl.xaml.cs
  • Uses existing HandleSubmit path — same behavior as clicking the submit button
  • No impact on cards without submit/execute actions
  • No impact on multiline text inputs

Fixes #46003

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>
@github-actions github-actions Bot added the Product-Command Palette Refers to the Command Palette utility label Jun 21, 2026
@michaeljolley michaeljolley self-assigned this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmdpal: Support Enter key to submit FormContent (Adaptive Card) inputs

1 participant