testing-library / testing-library/user-event

Inputs are not focused when clicked (v14)

Open
#1,002 21 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproduction example

https://github.com/IanVS/storybook-testing-user-event-click-focus

Prerequisites
  1. Using V14, try to click an input field: await userEvent.click(getByRole('textbox')); for example
Expected behavior

The input element should be fully focused, ready to accept user input (flashing cursor).

Actual behavior

The input is half-way focused, with a focus ring, but no flashing cursor.

User-event version

14.3.0

Environment

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

JS framework: react@18.2.0

Test environment: storybook@6.5.9

DOM implementation: browser

Additional context

This was working correctly in V13. I have instructions in the README of the reproduction of how to verify.

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 reproduction repository and its README, then run await userEvent.click(getByRole('textbox')) under user-event v14. Compare the result with v13 and trace the click behavior from userEvent.click; done means the textbox is fully focused and shows a flashing cursor.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.