Skip to content

fix: submit form with external submit button when user clicks enter (#1220) #1288

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

struank-l
Copy link

What

This PR fixes bug #1220 - userEvent.keyboard('{Enter}') doesn't trigger form submission when the submit button is outside the form element, even if it’s associated with the form element by using the button's form attribute.

Why

form should be submitted if the user clicks enter on a field in the form and there is a button outwith the form linked by form attribute.

How

if a submit button is not found within the form by the current code, and the form has an id set then search within the document for a suitable button with the correct form id

Checklist

  • n/a Documentation
  • [ x] Tests
  • [ x] Ready to be merged

Copy link

codesandbox-ci bot commented Jun 7, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

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.

2 participants