UI + UX Input And Data Entry standard

Drag-and-drop upload

Provide a clear drop zone as an enhancement on top of a real file picker, expose drag states, prevent destructive browser defaults, validate dropped files, allow cancellation and removal, and keep upload progress separate from final submission.

Decision first

Choose this pattern when the problem matches

Use when

  • Users often upload files from a desktop file manager and benefit from dropping one or more files into a visible target.
  • The product can provide a reliable file-picker fallback with the same validation and upload states.
  • The upload surface can show drag-over, invalid, cancelled, queued, progress, remove, retry, and final submit states.
  • Dropping a file is a shortcut, not the only way to complete the task.

Avoid when

  • The main audience is mobile-only or cannot reasonably drag files from the operating system.
  • A normal file input is sufficient and the extra drop-zone states would add confusion.
  • The workflow cannot safely prevent missed-drop browser navigation or recover from mistaken drops.
  • The file contains structured data that needs bulk import validation and import results.
  • The implementation cannot provide keyboard, click, touch, and assistive technology fallback.

Problem it prevents

Drag-and-drop upload can make desktop attachment workflows faster, but it fails when the target is ambiguous, the page swallows drops, non-file drags are accepted, or the drop zone replaces accessible file selection.

Pattern anatomy

What a strong implementation has to make clear

User need

Users are likely to have one or more files visible in a desktop file manager and want to move them into the product quickly.

Pattern promise

Provide a clear drop zone as an enhancement on top of a real file picker, expose drag states, prevent destructive browser defaults, validate dropped files, allow cancellation and removal, and keep upload progress separate from final submission.

Required state

Idle drop zone with visible label, requirements, and choose-file fallback.

Recovery path

The drop zone is not discoverable because it looks like decoration until a file is already being dragged.

Access contract

Keep a visible label and instructions that name both drag-and-drop and choose-file paths.

Quality bar

The difference between expert and weak execution

Strong implementation

Specific, visible, recoverable

  • A drop zone says Drag bank statements here or choose files, shows PDF/PNG/JPG up to 10 MB, highlights when files hover over it, lists two dropped filenames, and keeps a Choose files button visible.
  • A media uploader thickens the drop-zone border on valid drag-over, shows Not supported for a dragged link, and stacks uploaded filenames below the target with remove controls.
  • A user drags two PDFs over the zone, sees the target activate, drops them, reviews both filenames, removes the wrong one, uploads the remaining file, and then continues.
  • A keyboard user activates Choose files in the same drop zone and gets the same queued-file, progress, remove, and retry states as pointer users.
Weak implementation

Vague, hidden, hard to recover from

  • A dashed rectangle says Drop here but has no label, no click fallback, no accepted formats, and no state change while files hover over it.
  • The whole page becomes a hidden drop target that opens the dropped file in the browser when users miss the box.
  • A user drags a file over the page, misses the small target, and the browser navigates to the file, wiping unsaved answers.
  • A mobile user sees only Drag files here and cannot upload because there is no file-picker button or alternate route.
UI guidance
  • Render a large labelled drop zone with clear copy that says users can drag files there or activate a normal file picker, plus visible format, size, and count requirements.
  • Change border, background, icon, and status text for drag-enter, valid drag-over, invalid drag-over, drag-leave, dropped, uploading, uploaded, and error states without relying on color alone.
UX guidance
  • Use drag-and-drop upload as an enhancement for users who can drag files from a file manager, while preserving an equivalent click, keyboard, and mobile path.
  • Let users cancel by leaving or dropping outside the target, reject non-file or unsupported drags without losing progress, and require review before final submission.
Implementation contract

What the implementation must handle

States

  • Idle drop zone with visible label, requirements, and choose-file fallback.
  • Drag enter state announcing that files are over the upload area.
  • Valid drag-over state showing the target will copy or accept the files.
  • Invalid drag-over state for links, text, folders, unsupported formats, or too many files.

Interaction

  • Dragenter and dragover make the target visibly active only when the incoming data includes files.
  • Dragover cancels the browser default action so the drop event can be handled and the cursor can show copy or none.
  • Dropping files reads DataTransfer files or items, validates them, and adds accepted files to the same queue used by the file input fallback.
  • Dropping links, text, folders, unsupported formats, or too many files keeps existing queued files intact and explains the rejected data.

Accessibility

  • Keep a visible label and instructions that name both drag-and-drop and choose-file paths.
  • Expose the choose-file fallback as a real button or file input reachable by keyboard.
  • Do not rely on deprecated drag-and-drop ARIA attributes for new content.
  • Announce meaningful state changes such as files queued, invalid drag, upload failed, and upload complete.

Review

  • Do users actually have files available to drag from a desktop file manager?
  • What is the equivalent path for keyboard, mobile, screen reader, public-device, and locked-down desktop users?
  • What happens if users drag over the page, leave the target, drop outside it, or drop a link instead of a file?
  • Can users see which files were accepted, rejected, uploading, uploaded, removed, or still waiting for final submit?
Interactive lab

Inspect the states before you copy the pattern

Drop files into an upload zone

Drag over the drop zone, leave to cancel, drop multiple files, reject a non-file drag, use the click fallback, remove a file, and inspect upload progress.

Drag-and-drop upload
Interactive demo is ready

Launch the live UI/UX lab when you want to inspect states, keyboard behavior, and common failure modes.

State To Inspect

Idle drop zone with visible label, requirements, and choose-file fallback.

Keyboard / Access

Tab reaches the drop zone or choose-file fallback, queued-file remove controls, retry controls, and following form controls.

Avoid Generating

Replacing the normal file chooser with a drop zone that only pointer users can operate.

Evidence trail

Source-backed claims behind this guidance

Carbon Design System: File uploader

IBM - checked

Carbon supports drag-and-drop uploader variant guidance, drop-zone copy, active border changes, click fallback, keyboard activation, focus return, selected files, removal, and invalid states.

MDN: File drag and drop

Mozilla - checked

MDN supports file drop-zone implementation with file input fallback, dragover cancellation, DataTransferItem files, drop processing, and clear behavior.

GOV.UK Design System: File upload

Government Digital Service - checked

GOV.UK supports improved file upload behavior with both Choose file and drag-and-drop options, plus labels, hints, errors, and multiple selection.

Full agent/debug reference

Problem Context

  • Users are likely to have one or more files visible in a desktop file manager and want to move them into the product quickly.
  • The same workflow must still work for keyboard, mobile, assistive technology, public-device, and locked-down desktop users.
  • Files can be dragged over the wrong part of the page, leave the target, include unsupported types, or include non-file data such as links or text.
  • The browser may try to open dropped files unless the app prevents default handling only when file drags are involved.
  • The product needs to show queued, uploading, uploaded, failed, removed, and final submit states after a drop.

Selection Rules

  • Choose drag-and-drop upload when dropping files from a desktop file manager is a common, useful shortcut.
  • Use ordinary file upload when the task needs dependable attachment selection without extra drop-zone complexity.
  • Use text input when users can type the needed value instead of attaching a file.
  • Use multi-step form when the upload is one controlled step in a longer saved journey.
  • Use bulk import when the dropped file is structured data requiring mapping, row validation, and an import report.
  • Do not make drag-and-drop the only upload path.
  • Do not turn the entire page into an invisible drop target unless every drop outcome is clear, cancellable, and recoverable.
  • Accept only file drags in the drop zone and reject links, text, unsupported formats, too many files, or oversized files with explicit messages.
  • Prevent browser default file navigation only for file drags and only where the app can give users a safe outcome.
  • Require review or a separate submit action when a dropped file could affect a high-stakes transaction.

Required States

  • Idle drop zone with visible label, requirements, and choose-file fallback.
  • Drag enter state announcing that files are over the upload area.
  • Valid drag-over state showing the target will copy or accept the files.
  • Invalid drag-over state for links, text, folders, unsupported formats, or too many files.
  • Drag leave or cancelled state that returns the zone to idle without uploading.
  • Dropped queue state listing filenames, type, size, and count.
  • Uploading state with progress tied to each dropped file or batch.
  • Uploaded state with remove or replace controls.
  • Rejected drop state with clear recovery and requirements repeated.
  • Submitted state that confirms dropped files are included only after final review.

Interaction Contract

  • Dragenter and dragover make the target visibly active only when the incoming data includes files.
  • Dragover cancels the browser default action so the drop event can be handled and the cursor can show copy or none.
  • Dropping files reads DataTransfer files or items, validates them, and adds accepted files to the same queue used by the file input fallback.
  • Dropping links, text, folders, unsupported formats, or too many files keeps existing queued files intact and explains the rejected data.
  • Leaving the target before release cancels the drag affordance and does not upload anything.
  • Removing a dropped file affects only that file and keeps other queued files and form answers visible.
  • Click, keyboard, and file-input selection produce the same selected-file list, progress, validation, remove, retry, and submit behavior as drag-and-drop.

Implementation Checklist

  • Define accepted file kinds, maximum file size, maximum count, folder policy, duplicate policy, non-file drag policy, upload timing, and final submission boundary.
  • Implement the drop target with a real file input or accessible button fallback so activation with Enter, Space, click, touch, and screen readers follows the same code path.
  • Handle dragenter, dragover, dragleave, and drop events; prevent default file navigation for file drags and set an appropriate drop effect.
  • Process DataTransfer files, reject non-file data safely, validate type, size, and count, and add accepted files to a visible queue.
  • Show active, invalid, cancelled, queued, uploading, uploaded, failed, removed, and submitted states near the drop zone.
  • Provide remove, replace, retry, and final review controls before submission.
  • Test desktop file-manager drags, missed targets, browser Back, keyboard fallback, mobile fallback, screen readers, zoom, slow networks, duplicate files, and unsupported file types.

Common Generated-UI Mistakes

  • Replacing the normal file chooser with a drop zone that only pointer users can operate.
  • Letting dropped files outside the target open in the browser and erase unsaved progress.
  • Showing a dashed box that does not change state during drag enter, drag over, or invalid drag.
  • Accepting links or text as if they were files.
  • Automatically submitting a transaction immediately after drop.
  • Clearing all queued files when one dropped file is invalid.
  • Using a drop zone for bulk import without mapping, row-level errors, partial success, or import results.

Critique Questions

  • Do users actually have files available to drag from a desktop file manager?
  • What is the equivalent path for keyboard, mobile, screen reader, public-device, and locked-down desktop users?
  • What happens if users drag over the page, leave the target, drop outside it, or drop a link instead of a file?
  • Can users see which files were accepted, rejected, uploading, uploaded, removed, or still waiting for final submit?
  • Does the implementation prevent destructive browser file navigation without hijacking ordinary links and text?
  • When should users be allowed to undo, remove, retry, or confirm after a drop?
Accessibility
  • Keep a visible label and instructions that name both drag-and-drop and choose-file paths.
  • Expose the choose-file fallback as a real button or file input reachable by keyboard.
  • Do not rely on deprecated drag-and-drop ARIA attributes for new content.
  • Announce meaningful state changes such as files queued, invalid drag, upload failed, and upload complete.
  • Keep accepted and rejected filenames available as text, not only thumbnails.
  • Ensure a drag can be cancelled by leaving or dropping outside the target without side effects.
  • Provide remove, retry, and final submit controls that are keyboard reachable.
Keyboard Behavior
  • Tab reaches the drop zone or choose-file fallback, queued-file remove controls, retry controls, and following form controls.
  • Enter or Space on the fallback opens the file picker and produces the same queue behavior as dropping files.
  • Keyboard users can remove, retry, and submit queued files without needing pointer drag gestures.
  • Focus returns near the drop zone after file selection, rejected file feedback, remove, or retry.
  • Escape or leaving the drop target cancels the drag affordance where the platform exposes that interaction.
  • A required-upload error can be reached from an error summary and lands focus on the drop-zone instructions or fallback control.
Variants
  • Single-file drop zone
  • Multiple-file drop zone
  • Image drop zone with preview
  • Document drop zone
  • Drop zone with click fallback
  • Drop zone with batch progress
  • Drop zone with rejected-file list
  • Drop zone with remove or undo
  • Drop zone inside a form step
  • Drop zone with server scan state

Verification

Last verified: