Skip to content
easeweb
Search topics

File upload drop zones with no button to choose files

An expense form's receipts box takes files only by drag and drop, or by a click on the box itself, so nothing in it takes focus or is read as a button.

WCAG 2.2
SC 2.1.1ASC 2.5.7AA· new in 2.2SC 4.1.2A
Required by
Section 508 · EN 301 549 (EU)
Broken zone.addEventListener('drop', dropFiles);
The accessibility problem illustrated: Motor:How do I add my receipt?
01

The problem

People who can't drag, and keyboard and screen reader users, can't attach a receipt, so the claim can't be sent.

02

Try it

Attach a receipt by dragging a file onto the box. Then put the mouse aside and try again with Tab.

  • Broken 1: drag one of the files under the form, or a file from your computer, onto the box. Then Tab from Amount: focus jumps to Submit claim, and no click or key adds a file.

  • Broken 2: a click on the box now opens the file picker. Tab still passes it, and the panel never says there is anything to press.

  • Apply a fix. Tab stops on the box’s control, Enter or Space opens the file picker, and dropping still works.

Broken Can you fix this?

On your computer: drag a file onto the box taxi-receipt.pdfhotel-invoice.pdf

Screen reader says:

(Tab through the form)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep the drop, and add a button that opens the file picker.

Before

A box that takes only dropped files

<div class="field">  <span class="field-label" id="receipts-label">Receipts</span>  <div class="drop-zone">    <p>Drag and drop receipts here</p>  </div>  <ul class="file-list"></ul></div>
What is wrong3 points
  • A drop is the only way in.
  • Nothing in the box takes focus.
  • No click or key adds a file.
After

A Choose files button that opens the hidden input

<div class="field">  <span class="field-label" id="receipts-label">Receipts</span>  <div class="drop-zone">    <p>Drag and drop receipts here, or</p>    <button type="button" class="choose" aria-describedby="receipts-label">Choose files</button>    <input type="file" id="receipts" multiple hidden>  </div>  <ul class="file-list"></ul></div>
How it is fixed3 steps
  1. Add a native Choose files button to the box. The browser puts it in the Tab order, activates it with Enter or Space, and gives it a role.
  2. Let its own text name it, and make the field's label its description, so it is read something like "Choose files, button, Receipts".
  3. Move the click that opens the input from the box to the button, and take cursor: pointer off the box. One click, tap or key press opens the file picker, and voice control users can say "Click Choose files".

This fixes both Befores and passes 2.1.1, 2.5.7 and 4.1.2. The input stays hidden with hidden: calling click() on it still opens the picker in current browsers, and the button does everything a person needs. The drop works as before.

04

Design ideas

A place to drop files can take any shape, as long as it has a button.

Five ways to draw the place for receipts. Drag a file from your computer onto each, then put the mouse aside and use Tab: four have a button that opens the file picker, and one takes files only by a drop.

In the design file

  • Draw the button that chooses files at rest, with its words, not only the words that ask for a drop.
  • Draw the place at rest, and again with a file held over it.
  • Draw the button with its focus ring, and the list of files once some are added, each with its own Remove button.
  • Draw the phone layout, where nothing can be dragged in and the button is the only way to add a file.

Passes

  • Receipts
    Attach button with file chips No box at all: a quiet outlined pill with a paperclip, and each file added becomes a chip with its own × to remove it. A file dropped anywhere on the field is taken too, so the drop stays as a shortcut and the form stays compact. The pill’s blue text is 6.09:1 on white.
  • Drop receipts here or

    “browse” as a button in the sentence A soft blue panel with no dashed edge, and one word in its sentence is the button: “browse”, underlined and bold in the site’s blue, 5.47:1 on the panel’s tint. Only the word takes the click and the Tab stop, so its focus ring hugs the word, and it needs a name that says what it chooses, such as “browse for receipts”.
  • Receipts

    None added yet.

    A drop target that appears only while a file is held At rest the card shows only its Add receipts button, and the drop area appears over the whole card only while a file is dragged onto it, with a blue edge and “Drop to attach”. The screen stays calm, the target is as large as it can be, and the button never moves.
  • Receipts
    • taxi.pdf
    • lunch.jpg
    An Add receipt tile beside the ones added The receipts already added are small paper tiles, and the last tile is a dashed one with a plus and the words “Add receipt”. The tile is a button, so a tap or Enter opens the file picker, and a file dropped on it is taken as well. Keep the words: a plus on its own needs a name the eye can’t see.

Fails

  • No receipts yet Drop receipts anywhere on this page
    An empty state that says “Drop receipts anywhere”WCAG 2.5.7 A friendly illustration, “No receipts yet” and “Drop receipts anywhere on this page”: the cleanest empty state of all, and the drop does work. But nothing on it can be pressed, so Tab finds nothing, a click does nothing, and on most phones there is no way to add a receipt at all.
05

Verify the fix

5 checks.

Test with: Keyboard, Screen reader, Mouse, Touch, Speech input

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the upload component or its library changes.

How screen readers handle aria-describedby

Limits

This is a starting pattern, not a guarantee for every application. Moving cards and list items by dragging is covered in drag-and-drop boards that only a mouse can use, and asking what an uploaded photo shows in image uploads that never ask for alt text. A progress bar for a large upload has its own needs: see progress bars and meters that screen readers can't read. Pasting a file, or uploading a whole folder, is not covered here. The file picker belongs to the operating system, and its keys and screen reader support differ between systems: test the complete journey with your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service