testing-library / testing-library/user-event

type/keyboard modifier key not working as described in the docs

Open
#1,128 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproduction example

https://codesandbox.io/s/user-event-modifiers-not-working-78eg54?file=/src/App.test.js

Prerequisites
render(<input />);

const input = screen.getByRole("textbox");

await userEvent.type(input, "{Shift>}a{/Shift}");

expect(input.value).toBe("A");
Expected behavior

Input value should be A (uppercase) if I understand the docs correctly

Actual behavior

Input value is a (lowercase)

User-event version

14.4.3

Environment

Testing Library framework: @testing-library/react@14.0.0

JS framework: react@18.2.0

Test environment: jest@29.5.0

DOM implementation: jsdom@20.0.3

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 the linked CodeSandbox, particularly /src/App.test.js, and run the example using user-event 14.4.3. Trace the modifier-key behavior until the source of the lowercase result is clear; done means the documented {Shift>}a{/Shift} interaction produces an uppercase A.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing
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.