Visitar URL original
USWDS - File input: Remove drag instruction on mobile by manichandra · Pull Request #6660 · uswds/uswds · GitHub
Skip to content

USWDS - File input: Remove drag instruction on mobile - #6660

Merged
ethangardner merged 8 commits into
uswds:developfrom
manichandra:codex/uswds-3567-file-input-mobile
Jul 9, 2026
Merged

ethangardner merged 8 commits into
uswds:developfrom
manichandra:codex/uswds-3567-file-input-mobile

Conversation

@manichandra

@manichandra manichandra commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Improved file input instructions on mobile devices. The file input now removes drag-and-drop language on coarse pointer devices and uses “Choose from folder” as the visible instruction and aria label.

Breaking change

⚠️ This is potentially a breaking change.

Related issue

Closes #3567

Related pull requests

None.

Preview link

Preview link: N/A

Problem statement

The file input displayed “Drag file here or choose from folder” on mobile devices, where dragging a file from another window is not a sensible interaction. This could make the instruction confusing for mobile users and assistive technology users.

Solution

Updated the file input instructions to detect coarse pointer devices and hide the drag-and-drop instruction in that context. Desktop file inputs keep the existing “Drag file here or choose from folder” instruction, while coarse pointer devices show and announce “Choose from folder.”

Major changes

  • Added coarse pointer detection for file input instructions.
  • Removed visible drag text on coarse pointer devices.
  • Updated the default aria-label to match the visible mobile-safe instruction.
  • Added unit coverage for desktop and coarse pointer instruction behavior.

Testing and review

Tested locally with:

npx prettier --check packages/usa-file-input/src/index.js packages/usa-file-input/src/test/single-file-input.spec.js
ESLINT_USE_FLAT_CONFIG=true npx eslint --config='eslint.config.mjs' packages/usa-file-input/src/index.js packages/usa-file-input/src/test/single-file-input.spec.js
./node_modules/.bin/mocha --require jsdom-global/register packages/usa-file-input/src/test/*.spec.js
git diff --check

@manichandra

Copy link
Copy Markdown
Contributor Author

after the fix

image

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this contribution, and I appreciate your patience waiting for me to review it. This was a really smart approach you took to showing the relevant text for each device type. I like the pointer media query and matchMedia approach you took with these changes. That said, I do have a few suggestions that I added to the relevant lines of code in this PR. Thanks again for tackling this. These are refinements on top of genuinely solid work.

Comment thread packages/usa-file-input/src/index.js Outdated
Comment thread packages/usa-file-input/src/index.js Outdated
Comment thread packages/usa-file-input/src/index.js Outdated
@github-project-automation github-project-automation Bot moved this from Triage to In progress in USWDS Core Project Data Jun 23, 2026
@github-actions

github-actions Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ All commits on this PR have a verified signature. Thanks!

@ethangardner ethangardner moved this from In progress to Initial Fed Review in USWDS Core Project Data Jun 30, 2026
@ethangardner

Copy link
Copy Markdown
Contributor

Hi @manichandra - I see you made some changes here. If this is ready for review, please let me know or click the "re-request" review button next to my name under the "Reviewers" heading

@ethangardner ethangardner added the Needs: Author Response 🔴 Waiting on a specific author action; also used by commit-signature automation. label Jul 1, 2026
@manichandra
manichandra requested a review from ethangardner July 1, 2026 15:50
@github-actions github-actions Bot removed the Needs: Author Response 🔴 Waiting on a specific author action; also used by commit-signature automation. label Jul 1, 2026
@manichandra

Copy link
Copy Markdown
Contributor Author

Thanks, Ethan. This is ready for review. I addressed the review feedback by making the file input instructions mobile-first, removing the legacy IE/Edge check, and adding media-query change handling with teardown cleanup. I also expanded the file input tests.

@ethangardner

Copy link
Copy Markdown
Contributor

@manichandra - Thanks! I'll queue this up to review the changes and let you know how it looks.

@manichandra

Copy link
Copy Markdown
Contributor Author

@ethangardner UAW. let me know of you would like to me help resolve any issues related to accessibility or anything critical. I have actually built a chrome extension to visually see accessibility issues. details are here - https://dev.to/manichandra_sajjanapu/one-aria-bug-a-million-apps-meet-aria-reach-86h

@ethangardner ethangardner moved this from Initial Fed Review to In progress in USWDS Core Project Data Jul 8, 2026

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for this change.

@ethangardner
ethangardner merged commit 6363387 into uswds:develop Jul 9, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Fed Final Review in USWDS Core Project Data Jul 9, 2026
@chandracarney chandracarney moved this from Fed Final Review to Done in USWDS Core Project Data Jul 20, 2026
@annepetersen annepetersen added this to the uswds 3.14.0 - Aug 2026 milestone Aug 4, 2026
@annepetersen annepetersen added ❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage. Is: Breaking 🔴 Suggestion would be a breaking change labels Aug 4, 2026
@annepetersen annepetersen added the Package: File Input Work affecting File Input. Apply only when this area helps route or find the issue. label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Is: Breaking 🔴 Suggestion would be a breaking change Package: File Input Work affecting File Input. Apply only when this area helps route or find the issue. ❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

File Input: "Drag file here" instruction is not sensible for mobile devices

4 participants