EST: fix document upload on input-fallback browsers (react-dropzone v14)#22
Merged
bhavananarayanan merged 1 commit intoJun 26, 2026
Merged
Conversation
react-dropzone v14 only uses the File System Access API in a secure
context AND a Chromium browser (window.isSecureContext && 'showOpenFilePicker'
in window). Everywhere else (plain HTTP, Firefox, Safari) it falls back to a
hidden file <input> — and that fallback path was broken:
- outbound/combined-shipments SendMovementPage rendered the Dropzone
render-prop without <input {...getInputProps()} />, so open() clicked a
null input ref and nothing happened.
- DropzoneFileSelect spread {...fieldProps} (still containing onChange) onto
the wrapper div, so the bubbled native change event invoked the handler
with a SyntheticEvent instead of a file array, crashing the inbound send
step (Invalid attempt to spread non-iterable instance).
Masked on localhost-Chrome (FS Access API path) which is why it only
reproduced on dev/UAT and in Firefox.
Upstream touch points (all upstream files):
- src/js/components/form-elements/v2/DropzoneFileSelect.jsx
- src/js/components/stock-movement-wizard/outbound/SendMovementPage.jsx
- src/js/components/stock-movement-wizard/combined-shipments/SendMovementPage.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 References
📝 Implementation
outbound+combined-shipmentsSendMovementPage— render<input {...getInputProps()} />inside the<Dropzone>render-prop. react-dropzone v14 no longer auto-renders the input; without itopen()clicks a nullinputRefand nothing happens.DropzoneFileSelect— destructureonChangeout of...fieldPropsso it is no longer spread onto the wrapper<div>. Previously the bubbled nativechangeevent invoked the handler with aSyntheticEventinstead of a file array, crashing the inbound send step (Invalid attempt to spread non-iterable instance).onChangeis still wired throughonDrop.✨ Description of Change
Description:
The "Upload Documents" button did nothing on the outbound send step, and the inbound send step went to a blank screen, on dev/UAT and in Firefox — but not on a developer's localhost.
Root cause is react-dropzone v14: it only uses the browser File System Access API when all of
window.isSecureContext && useFsAccessApi (default true) && 'showOpenFilePicker' in windowhold — i.e. a secure context AND a Chromium browser. Everywhere else (plain HTTP such as the dev box, or Firefox/Safari on any URL) it falls back to a hidden file<input>, and that fallback path was broken in two ways:inputRef.current.click()hitnull.DropzoneFileSelectleakedonChangeonto the root<div>, so the native inputchangeevent bubbled up and fired the handler with an event object → spread crash.Both were masked on localhost + Chrome (secure + Chromium → FS Access API, which needs no input element and emits no bubbling change event), which is why it only reproduced off localhost / outside Chrome.
This is an upstream OpenBoxes bug (all three files are upstream); carrying the fix on EST as an interim. A separate upstream PR to PIH is planned so the patch can be dropped on a future version bump.
Upstream touch points (all upstream files — future merge-conflict candidates):
src/js/components/form-elements/v2/DropzoneFileSelect.jsxsrc/js/components/stock-movement-wizard/outbound/SendMovementPage.jsxsrc/js/components/stock-movement-wizard/combined-shipments/SendMovementPage.jsxOut of scope: documents persist on Send (dispatch), not on Save — that is existing upstream behaviour and unchanged here.
📹 Screenshots/Screen capture
Tested localhost in firefox
2026-06-25.14-31-34.mp4
🔥 Notes to the tester
Test in Firefox (or any non-Chromium browser, or over plain HTTP) — that is the fallback path the fix repairs. Chrome-on-localhost masks the bug.