testing-library / testing-library/user-event
Stop toggling a checkbox when pressing the Enter key
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://codesandbox.io/p/sandbox/unruffled-snyder-cvtnvn
Prerequisites
- Render an
<input type="checkbox" /> - Focus the checkbox
- 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
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 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