testing-library / testing-library/user-event

Should not be able to type on inert items

Open
#1,215 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

Reproduction example

https://github.com/storybookjs/storybook/issues/27138

Prerequisites
<form inert="true">
      <input placeholder="not focusable" />
</form>

should not be able to click, focus or write with

await expect(input).toBeEnabled();
await userEvent.type(input, 'can write');
Expected behavior

If an element is inert it should fail to write and fail expects

Actual behavior

nothing happens

User-event version

14.5.2

Environment

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

JS framework: react@18.3.1

Test environment: vitest@1.4.0

DOM implementation: happy-dom@13.8.6

Additional context

https://github.com/storybookjs/storybook/issues/27138

https://github.com/capricorn86/happy-dom/issues/1422

https://github.com/jsdom/jsdom/issues/3605

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the form and input example with the listed userEvent.type call, then inspect the user-event handling for enabled, focus, and typing checks. Done means inert inputs reject clicking, focusing, and typing, and a regression test verifies the expected failure behavior across the relevant DOM environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.