testing-library / testing-library/user-event
userEvent.keyboard('{Enter}') does not trigger form submission in forms with radio group elements
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction example
https://stackblitz.com/edit/rtl-template-dg4qziej?file=src%2FApp.tsx
Prerequisites
- Render the form with radio group and text input field.
- Submit the form using user event keyboard while focus on input text element
userEvent.keyboard('{Enter}')does trigger form submission
Expected behavior
userEvent.keyboard('{Enter}') does trigger form submission
Actual behavior
userEvent.keyboard('{Enter}') does not trigger form submission
User-event version
14.5.2
Environment
Testing Library framework: @testing-library/react@16.0.1
JS framework: react@18.2.0
Test environment: vitest@2.1.2
DOM implementation: jsdom@24.1.1
Additional context
Issue: userEvent.keyboard('{Enter}') does not trigger form submission when the form contains radio group elements.
Observation: Using fireEvent.submit successfully triggers form submission under the same conditions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction in src/App.tsx and confirm the failure when a form contains a radio group and text input. Trace the userEvent.keyboard('{Enter}') path, then verify that Enter submits the form in this case without relying on fireEvent.submit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100