testing-library / testing-library/user-event

Stop toggling a checkbox when pressing the Enter key

Open
#1,273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproduction example

https://codesandbox.io/p/sandbox/unruffled-snyder-cvtnvn

Prerequisites
  1. Render an <input type="checkbox" />
  2. Focus the checkbox
  3. Press Enter
Expected behavior

The checkbox is focused, but it does not change its state.

If the checkbox is checked, the user presses Enter, the checkbox is unchecked.

Actual behavior

The checkbox does not change its state.

If the checkbox is checked, the user presses Enter, the checkbox is still checked.

User-event version

14.1.1

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation:

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 linked CodeSandbox reproduction and the checkbox keyboard interaction in user-event 14.1.1. Reconcile the contradictory expected-behavior wording, then verify Enter handling for focused checked and unchecked checkboxes with a regression check; done means the checkbox state matches the clarified behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.