Skip to content

Pressing keys ([Enter], [ArrowDown], etc.) does not work in antd select combobox input. #1137

Closed
@karoAlfa

Description

@karoAlfa

Reproduction example

https://codesandbox.io/s/selectcombobox-test-nhch9c

Prerequisites

  1. Use antd components library.
  2. Render Select component with some options.
  3. In the test get element by role 'combobox' (const input = screen.getByRole('combobox');)
  4. Focus on the element (await user.click(input)).
  5. In the keyboard type ArrowDown, ArrowDown, Eneter (await user.keyboard('[ArrowDown][ArrowDown][Enter]')).

Expected behavior

One of the options should be selected, and therefore handleChange function should be triggered.

Actual behavior

The handleChange function is not triggered at all.

User-event version

14.4.3

Environment

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

JS framework: react@18.2.0

Test environment: jest@29.5.0

Antd library: antd@5.3.2

Additional context

Recently, I've decided to upgrade my user-event package from 13.5.0 to 14. I have not had problems migrating tests with buttons, numeric input, and text inputs. But for some reason, combobox input behaves differently, and it looks like I can not use function keys on it such as ArrowDown, Enter, etc. It is worth mentioning that in the previous version (before 14), user-event worked perfectly fine with Select components from antd library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions