question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Clicking the dropzone area won't open the choose file dialog on newest Chrome

See original GitHub issue

Hello and thanks for the great hook. I came across this bug this morning and thought that it should be reported.

Describe the bug When clicking the dropzone, the dialog for choosing files does not appear. This might be due to browser update. Yesterday the click to open dialog was working as expected.

To Reproduce

    const { getRootProps, getInputProps } = useDropzone({
        validator: duplicateFileValidator,
        onDrop: (files: File[]) => {
            const uniques = Array.from(new Set(filesArray))
            setFilesArray([...uniques, ...files])
        },
        accept: acceptedFileTypes,
        maxSize: maxSizeBytes,
    })
<div className={styles.dropZone} {...getRootProps()} id="upload-file">
                    <input {...getInputProps()}/>
</div>

Expected behavior A dialog for choosing a file should open. Works as expected in Firefox.

Desktop (please complete the following information):

  • OS: macOS 12.5.1
  • Chrome 105.0.5195.102 (Official Build) (arm64)
  • React-dropzone version: 11.4.2

I tried it also on the latest 14.2.2, but same bug there.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
Egr711commented, Oct 14, 2022

Can confirm was having the same issue in Chrome 105.0.5195.125 upgrading to version 14.2.3 and updating chrome to latest 106.0.5249.119 fixed it

1reaction
immutable-procommented, Sep 15, 2022

I can confirm I am seeing the same behavior, using 14.2.2. It works on Firefox 104.0.2 and Gnome Web Browser 42.4, but not in Chrome 105.0.5195.125.

Some more details:

In openFileDialog callback function, window.showOpenFilePicker throws:

DOMException: Failed to execute 'showOpenFilePicker' on 'Window': Must be handling a user gesture to show a file picker.

When it tries to fall back to the inputRef click function, it fails, but it logs a warning in the console:

File chooser dialog can only be shown with a user activation.

Weirdly, some times window.showOpenFilePicker throws:

The user aborted the request
Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Form file chooser not opening on Chrome
I'm facing a problem that in Chrome the file upload chooser not showing up, but in Firefox and Safari it's opened and working...
Read more >
Drag and Drop file on Open / Save Dialog boxes to navigate to ...
Just upgraded an old mac from High Sierra to Monterey (Thanks to OCLP) and I noticed that when I drag and drop a...
Read more >
Examples - react-dropzone
getRootProps({className: 'dropzone'})}> <input {...getInputProps()} /> <p>Drag 'n' drop some files here, or click to select files</p> </div> <aside> ...
Read more >
Drop zone - Shopify Polaris
The drop zone component lets users upload files by dragging and dropping the files into an area on a page, or activating a...
Read more >
FileDrop.js - self-contained cross-browser HTML5, legacy ...
Fixed visual bugs when <fieldset> was used as a drop zone in Firefox 13 and up. ... clicks the drop zone and selects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found