testing-library / testing-library/user-event

ArrowUp / ArrowDown should fire onInput for input[type="range"]

Open
#1,067 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproduction example

https://codesandbox.io/s/magical-hoover-80m7jv?file=/src/range.test.tsx

Prerequisites
  1. Render an input[type="range"] element with an onInput handler (onChange for react applications)
  2. Focus the input element
  3. Call user.keyboard('{ArrowRight}'

See codesandbox link or https://github.com/ChristopherChudzicki/range-input-arrowkeys/blob/main/src/range.test.tsx

Expected behavior

The input handler should be called.

Actual behavior

The input handler is not called.

User-event version

14.4.3

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation:

Additional context

Per #843, I think this is an issue in @testing-library/user-event not JSDOM. #1066 is the analogous issue for numeric inputs.

IMO, resolving this issue would be of significant value since other methods of manipulating the range input (e.g., mouse movement) are harder to implement in some testing environments like JSDOM.

If this is a @testing-library/user-event issue, I'd be happy to try and implement it if someone can point me in the right direction.

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 range.test.tsx reproduction and inspect the keyboard handling and range-input tests in user-event. Compare ArrowRight behavior with the expected input-handler call, then add coverage showing the handler fires for ArrowUp and ArrowDown as well. Confirm the relevant test suite passes and that the reproduction is resolved.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.