Skip to content

Fix document upload in Firefox/Safari (outbound Send + DropzoneFileSelect) (#6031)#6032

Open
gqcorneby wants to merge 2 commits into
openboxes:developfrom
EyeSeeTea:bug/6031-outbound-send-document-upload
Open

Fix document upload in Firefox/Safari (outbound Send + DropzoneFileSelect) (#6031)#6032
gqcorneby wants to merge 2 commits into
openboxes:developfrom
EyeSeeTea:bug/6031-outbound-send-document-upload

Conversation

@gqcorneby

@gqcorneby gqcorneby commented Jul 16, 2026

Copy link
Copy Markdown

✨ Description of Change

Link to GitHub issue or Jira ticket: Fixes #6031

Description:

Document upload is broken in Firefox and Safari (and in any browser served over plain HTTP), in two places with the same root cause. react-dropzone v14 only uses the File System Access API in a secure-context Chromium browser (window.isSecureContext && 'showOpenFilePicker' in window); everywhere else it falls back to a hidden <input>, and two components don't handle that fallback correctly.

1. Outbound / combined-shipments Send page — clicking upload does nothing

outbound/SendMovementPage.jsx and combined-shipments/SendMovementPage.jsx render the dropzone render-prop without <input {...getInputProps()} />, so open() has no input to trigger. The legacy inbound/SendMovementPage.jsx already renders it and works; this adds the same two lines to the other two.

2. DropzoneFileSelect — crash after selecting a file

DropzoneFileSelect.jsx kept onChange inside {...fieldProps} and spread it onto the wrapper <div>. When the fallback <input> fires its native change event, it bubbles to the div and calls the handler with a SyntheticEvent instead of a file array, throwing Invalid attempt to spread non-iterable instance and blanking the inbound V2 Send page and every import flow (outbound import, location/category/bin import). Fixed by destructuring onChange out of the spread so it no longer lands on the div.

Both paths work in secure-context Chrome because react-dropzone uses the File System Access API there and never touches the input fallback, which is why this is easy to miss in dev.


📷 Screenshots & Recordings

Before recording attached in the issue.
Fix:

2026-07-16.16-11-59.mp4

The outbound and combined-shipments Send pages rendered the react-dropzone
render-prop without <input {...getInputProps()} />, so on non-Chromium /
non-secure-context browsers (where react-dropzone v14 falls back to a hidden
input) open() had no input to trigger and nothing happened. Add the fallback
input, matching inbound/SendMovementPage.jsx.

Fixes openboxes#6031
DropzoneFileSelect kept onChange inside {...fieldProps} and spread it onto the
wrapper div. When react-dropzone v14 falls back to a hidden <input> (any
non-Chromium / non-secure-context browser), the input's native change event
bubbles to the div and invokes the handler with a SyntheticEvent instead of a
file array, throwing "Invalid attempt to spread non-iterable instance" and
blanking the inbound Send page and every import flow.

Destructure onChange out of the spread so it no longer lands on the div.

Relates to openboxes#6031
@github-actions github-actions Bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document upload broken in Firefox/Safari - outbound Send does nothing, inbound/import crashes (react-dropzone v14 input fallback)

1 participant