testing-library / testing-library/user-event

Firefox: userEvent.click does not submit forms

Open
#1,075 10 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs investigation
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

Reproduction example

https://codesandbox.io/s/nervous-microservice-nmm3h7?file=/src/index.js

Prerequisites
  1. Use Firefox, not jsdom.
  2. Render a form with an onSubmit handler and a button inside the form such as <button type="submit" />.
  3. Use userEvent.click to click the button in the form.
Expected behavior

Form's onSubmit handler should trigger.

Actual behavior

Form's onSubmit handler does not trigger.

User-event version

14.4.3

Environment

Firefox 106.0.2 (64-bit) Linux

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in src/index.js from the linked CodeSandbox and run it in Firefox rather than jsdom, then trace the userEvent.click entry point. Done means a submit button's form onSubmit handler fires under Firefox as described in the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.