testing-library / testing-library/user-event
userEvent.type not typing into Material UI DatePicker if it has focus
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/userevent-type-material-ui-datepicker-bug-px38kj
Prerequisites
- Be on laptop/desktop such that the desktop variant of the DatePicker Component will be rendered. (Typing is not allowed in the mobile variant).
- Have dependencies installed as specified in the provided codesandbox
- Have a react component that renders the Material UI DatePicker Component
- 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
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
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