Skip to content

click handler should not fire blur when the click target inside currently focused element #566

Closed
@just-boris

Description

@just-boris
  • @testing-library/user-event version: 7.29.6 (latest at the time of writing)

  • Testing Framework and version: n/a

  • DOM Environment: Tested in Chrome/Safari/Firefox

Steps to reproduce

  1. Open this CodeSandbox: https://rvh87.csb.app/
  2. Click on "click with user-event" button
  3. You will see "blur" logs in the console
  4. Click on "test button" directly
  5. There are no "blur" logs in the console

Code Example:

Codesanbox source: https://codesandbox.io/s/rvh87

<button class="to-test">
  <span>test button</span>
</button>
userEvent.click(screen.getByText("test button"));

Suggested solution:

The library should check if the click target is inside already focused container and should not blur it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions