You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div>{showSuccess ? ('success') : (<formname="myform"onSubmit={handleSubmit}><labelhtmlFor="search">Search</label><inputtype="text"name="search"id="search"/>{/* // Comment the below code to make test case pass */}<div><label>Gender</label><inputtype="radio"name="gender"value="male"/><inputtype="radio"name="gender"value="female"/></div></form>)}</div>
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.
Suggested solution:
The text was updated successfully, but these errors were encountered:
vinothkumar-tw
changed the title
@testing-library/user-event / userEvent.keyboard Enter event is not triggered
userEvent.keyboard('{Enter}') does not trigger form submission in forms with radio group elements
Jan 16, 2025
@testing-library/react
version: 16.2.0vitest
version: 2.1.2@vitest/ui
version: 2.1.2@vitest/coverage-v8
version: 2.1.2@vitejs/plugin-react
version: 4.3.2jsdom
version: 24.1.1Relevant code or config:
What you did:
What happened:
userEvent.keyboard('{Enter}')
does not trigger form submissionReproduction:
https://stackblitz.com/edit/rtl-template-dg4qziej?file=vite.config.ts
Problem description:
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.Suggested solution:
The text was updated successfully, but these errors were encountered: