testing-library / testing-library/user-event
Wrong `Selection` when `<input/>` inside contenteditable is focused
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/nostalgic-sutherland-w2n2w8
Prerequisites
- Render
<div contenteditable="true"><input/></div> - Focus the
HTMLInputElement
Expected behavior
The selection has one collapsed range at the position of the input element.
Actual behavior
The selection has no range.
User-event version
14.5.2
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
No response
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
Start with the linked CodeSandbox reproduction and trace how focusing an HTMLInputElement inside a contenteditable element affects the Selection. Done means the selection contains one collapsed range at the input position instead of no range, under the reported Testing Library, React, Jest, and jsdom versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100