I run 14FreeTools, a set of free browser-only image and PDF tools. Every tool starts with the same thing: a dashed box where you pick or drop a file.
Watching a few people use it, I noticed something uncomfortable. They looked at the dashed box, read the text, and then waited. The label said "Select images" but nothing about it looked like a button. A dashed rectangle reads as "drop zone" to developers. To a normal person on a phone it reads as decoration.
Here is what I changed, and the small bits of code behind each change.
1. Put a real-looking button inside the zone
The whole box is still clickable, but the label is now styled as a solid, high-contrast pill. People click things that look like buttons. That one change matters more than everything else in this post.
<div class="drop" id="drop" role="button" tabindex="0" aria-label="Select images"> <svg class="drop-ic" aria-hidden="true">…upload icon…</svg> <span class="drop-btn">Select images</span> <span class="drop-or">or drop files here</span> <span class="drop-safe">🔒 Files stay on your device. Nothing is uploaded.</span> </div> <input type="file" id="file" accept="image/*" multiple hidden> .drop-btn{ background:linear-gradient(135deg,#7c3aed,#a855f7); color:#fff;font-weight:700;padding:15px 30px;border-radius:12px; box-shadow:0 8px 24px rgba(124,58,237,.38); } .drop:hover .drop-btn{transform:translateY(-1px)} @media (max-width:560px){.drop-btn{width:100%}} On small screens the button goes full width, because a thumb needs a big target.
2. Hide "or drop files here" on touch devices
Nobody drags files on a phone. Showing drag-and-drop text there is just noise:
@media (hover:none){ .drop-or{display:none} } (hover:none) is a better signal than screen width, because a small laptop window still has a mouse.
3. Make the div behave like a button for keyboard users
A div with a click handler is invisible to keyboard users. Adding role="button" and tabindex="0" gets it into the tab order and screen readers announce it correctly, but you still have to handle the keys yourself:
drop.addEventListener('click', () => input.click()); drop.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); // stop Space from scrolling the page input.click(); } }); And give it a visible focus ring with :focus-visible, so mouse users don't see an outline after every click but keyboard users always do.
4. Accept Ctrl+V paste
A surprising number of people want to compress or convert a screenshot. Making them save it to disk first, then find it in a file picker, is three wasted steps. The clipboard already has it:
document.addEventListener('paste', (ev) => { // don't hijack paste inside text fields if (/^(input|textarea)$/i.test(ev.target.tagName)) return; const files = Array.from(ev.clipboardData?.files || []); if (files.length) handleFiles(input.multiple ? files : files.slice(0, 1)); }); Two things to watch: skip the handler when the user is pasting into a text input, and respect multiple so a single-file tool doesn't receive five files.
5. Make the drag state obvious
When a file is being dragged over, the zone switches from a dashed to a solid border, gets a stronger glow and scales up by 1%. Small, but it tells people "yes, let go here".
['dragenter','dragover'].forEach(e => drop.addEventListener(e, ev => { ev.preventDefault(); drop.classList.add('over'); })); ['dragleave','drop'].forEach(e => drop.addEventListener(e, ev => { ev.preventDefault(); drop.classList.remove('over'); })); 6. Answer the privacy question inside the box
The first worry people have before choosing a photo of their CNIC or passport is "where is this going?". My tools run fully in the browser, so the box now says so in one green line right under the button. Answering the question at the moment it's asked beats a privacy page nobody opens.
The takeaway
The original drop zone was technically fine. It worked with a mouse, it accepted drops, it had a label. It just didn't look like something you could press. If your upload area is a dashed rectangle with grey text, try putting an actual button inside it and watch what happens.
You can see the tools here: 14freetools.com. Feedback welcome in the comments.
