testing-library / testing-library/user-event

upload() should support 'webkitdirectory' without 'multiple' being set

Open Beginner friendly
#1,292 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Problem description

The upload method doesn't support 'webkitdirectory' unless 'multiple' is also set to true. This is not the expected behaviour as selecting a single directory does not require 'multiple' to be set on the input.

Suggested solution

The upload method line 34 .slice(0, input.multiple ? undefined : 1) should be changed to .slice(0, input.multiple || input.webkitdirectory ? undefined : 1).

Additional context

No response

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 at the upload method on line 34 and inspect the slice condition described in the issue. Verify that directory selection works without multiple being set while preserving the existing single-file behavior, then run the relevant upload tests if available and confirm the behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.