[SPIKE] Dropzone interface for file upload component #3832
Closed
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.
One of the items flagged in the recent audit of Frontend was the lack of a user interface indicating that files could be dragged and dropped into the File Upload component.
Putting aside that our file upload component is the browser's native control with only light style customisations (and the usability issue is probably the onus of browser vendors, not us), I figured I'd do a technical spike of how we could do something about it in Frontend.
This is principally a technical prototype. It is intentionally very basic and ugly, and probably not as accessible as it could be, but it does (basically) what it says on the tin.
Screenshots
Initial state
Appears as a standard, native file input.
With a file dragged over the viewport
A previously hidden div with a dashed grey border and instructions that the user can drop a file here are revealed. The native file input is hidden.
With a file dragged over the dropzone
The div with instructions gains a more prominently coloured border when the user's cursor is within the bounds of it, indicating that it is safe to drop the file.
After a file is dropped
The component returns to only showing the native file input, with the value correctly set.