Skip to content

Commit 43e5574

Browse files
dominic-pokonet
authored andcommitted
fix: Set autocomplete="off" on input to remove SecurityError in Firefox (react-dropzone#476)
Firefox throws a SecurityError if user agent tries to set the input element's value programmatically. To prevent this, `autocomplete="off"` is added to the input attributes. Fixes react-dropzone#475
1 parent cf76683 commit 43e5574

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Dropzone basics should render children 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><p>some content</p><input type=\\"file\\" multiple=\\"\\" style=\\"display: none;\\"></div>"`;
3+
exports[`Dropzone basics should render children 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><p>some content</p><input type=\\"file\\" multiple=\\"\\" autocomplete=\\"off\\" style=\\"display: none;\\"></div>"`;
44
5-
exports[`Dropzone document drop protection does not prevent stray drops when preventDropOnDocument is false 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><input type=\\"file\\" multiple=\\"\\" style=\\"display: none;\\"></div>"`;
5+
exports[`Dropzone document drop protection does not prevent stray drops when preventDropOnDocument is false 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><input type=\\"file\\" multiple=\\"\\" autocomplete=\\"off\\" style=\\"display: none;\\"></div>"`;
66
7-
exports[`Dropzone document drop protection installs hooks to prevent stray drops from taking over the browser window 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><p>Content</p><input type=\\"file\\" multiple=\\"\\" style=\\"display: none;\\"></div>"`;
7+
exports[`Dropzone document drop protection installs hooks to prevent stray drops from taking over the browser window 1`] = `"<div class=\\"\\" style=\\"width: 200px; height: 200px; border-width: 2px; border-color: #666; border-style: dashed; border-radius: 5px;\\"><p>Content</p><input type=\\"file\\" multiple=\\"\\" autocomplete=\\"off\\" style=\\"display: none;\\"></div>"`;

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ class Dropzone extends React.Component {
358358
style: { display: 'none' },
359359
multiple: supportMultiple && multiple,
360360
ref: this.setRefs,
361-
onChange: this.onDrop
361+
onChange: this.onDrop,
362+
autoComplete: 'off'
362363
}
363364

364365
if (name && name.length) {

0 commit comments

Comments
 (0)