Skip to content

typing fails if input matches selection #583

@ph-fritsche

Description

@ph-fritsche

I have found what I believe to be a related issue to this one, which is documented in this CodeSandbox: https://codesandbox.io/s/userevent-unit-test-ncmgu?file=/src/App.test.js

Setup of the tested component

  1. contains a text input with an initial value of 1 string character (ex: '1')
  2. executes the HTMLInputElement.select() method on input focus so every new value completely overwrites the previous one

Test execution:

  1. Render the tested component with input
  2. Get the input by role
  3. Change the input value via userEvent.type(... (ex: '11123')
  4. Notice the received input value is '23' and not '11123'

Originally posted by @psullivan6 in #521 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions