testing-library / testing-library/user-event

userEvent.type not typing into Material UI DatePicker if it has focus

Open
#1,276 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/userevent-type-material-ui-datepicker-bug-px38kj

Prerequisites
  1. Be on laptop/desktop such that the desktop variant of the DatePicker Component will be rendered. (Typing is not allowed in the mobile variant).
  2. Have dependencies installed as specified in the provided codesandbox
  3. Have a react component that renders the Material UI DatePicker Component
  4. Have a test that uses userEvent.type to type into the DatePicker Component
Expected behavior

When the DatePicker component has focus before userEvent.type is called, then typing should occur and the field value should change accordingly.

Actual behavior

When the DatePicker component has focus before userEvent.type is called, then typing seems not to occur because the value of the field does not change.

User-event version

14.1.1

Environment

See package.json of codesandbox

Additional context

Example tests are provided in App.test.jsx in the codesandbox

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

Open the linked CodeSandbox and inspect App.test.jsx, then reproduce the focused Material UI DatePicker case with userEvent.type. Trace why the field value does not change and verify that typing works when the DatePicker already has focus without breaking the mobile-variant behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
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.