Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing Backspace multiple times results in wrong cursor position #1056

Open
JesseChain opened this issue Sep 16, 2022 · 1 comment
Open

Typing Backspace multiple times results in wrong cursor position #1056

JesseChain opened this issue Sep 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@JesseChain
Copy link

Reproduction example

https://codesandbox.io/s/elastic-surf-6qegdh?file=/src/App.test.js

Prerequisites

  1. Render <input type="text" />
  2. Type abc
  3. Press {ArrowLeft}{Backspace}{Backspace}

Expected behavior

input element value should be 'c' and cursor position should be 0

Actual behavior

The input element value is "a" and the cursor position is 1

User-event version

14.4.3

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation:

Additional context

No response

@JesseChain JesseChain added bug Something isn't working needs assessment This needs to be looked at by a team member labels Sep 16, 2022
@ph-fritsche ph-fritsche removed the needs assessment This needs to be looked at by a team member label Sep 16, 2022
@hudochenkov
Copy link

hudochenkov commented Oct 21, 2022

I experience similar problem and it boiled down to incorrect behavior with React 17 starting v14.2.6.

Test:

  1. Render <input type="text" /> and focus it.
  2. Using only keyboard press a, b, e, h
  3. Press {ArrowLeft}, {ArrowLeft}
  4. Press C, D
  5. Press {ArrowRight}
  6. Press F, G

Expected input value: abCDeFGh
Received input value: abCehDFG

Codepens:

Most likely this PR caused regression for React 17 in v14.2.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants