Skip to content

Upload does not work for non accepted files types #913

@ghost

Description

Reproduction example

https://codesandbox.io/s/compassionate-thunder-7dgq11?file=/src/App.test.js

Prerequisites

  1. render <input type="file" accept=".xlsx" onChange={handleFileChange} />
  2. try uploading file that is not one of the accepted types

Expected behavior

onChange is called

Actual behavior

onChange is not called

User-event version

14.0.4

Environment

No response

Additional context

It's still easy to bypass browsers accepted file types by user. So I want to test if error returned by back-end (mocked with MSW) is shown.
image

found this #421 where people seemed to agree that allowing uploading all types is way to go.

And this used to work with v13: https://codesandbox.io/s/nameless-platform-qnw290?file=/src/App.test.js

Seems upload used to have options, where applyAccept was defaulting to false. In changelog it's only mentioned that options was removed, but not that default has changed (and contradicts browser behavior)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions