Skip to content

Type into text field generate a Maximum call stack size exceeded error #849

@sschneider-ihre-pvs

Description

@sschneider-ihre-pvs
  • @testing-library/user-event version: ^14.0.0-beta

  • Testing Framework and version:
    jest: 26.6.3

  • DOM Environment:
    jsdom

Relevant code or config

      const { getAllByTestId } = createWrapper();
      await flushPromises();

      const dummyText = chance.string({ length: 50, alpha: true });

      const field = getAllByTestId(<someid>);
      // Input and Label have the same id
      await userEvent.clear(field[0]);
      await userEvent.type(field[0], dummyText); // <-- Here the error will be thrown

What you did:

I searched for a testId cleared the field to get rid of text that might already been in there. Type 50 characters to check that maxlength 40 works as expected for the user.

What happened:

The input triggered a cascade of clicks in an endless loop

at Object.<anonymous>.behavior.click (node_modules/@testing-library/user-event/dist/index.cjs:1387:11)

Problem description:

I used an inputelement as target, I don't know why the label is looked up and a trigger is fired, and I don't know why there seems to be a loop.

Suggested solution:

Break the infinite loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions