Skip to content

Cannot set the cursor position after programmatically modifying the value of input #971

@JesseCheng77

Description

@JesseCheng77

Reproduction example

https://codesandbox.io/s/serene-lehmann-1fkp6j?file=/src/App.test.js

Prerequisites

None

Expected behavior

The position of the cursor should always be 2 if you enter anything in input

Actual behavior

The cursor position is always reset to the end

User-event version

14.2.0

Environment

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

JS framework: react@16.14.0 react-dom@16.14.0

Test environment: jest@26.0.21 @testing-library/jest-dom@5.11.9

DOM implementation: jsdom@16.4.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions