Skip to content

fix: use a single hidden file input#942

Open
satyamtiwari-1499 wants to merge 2 commits into
magic-peach:mainfrom
satyamtiwari-1499:fix/fileupload-single-hidden-input
Open

fix: use a single hidden file input#942
satyamtiwari-1499 wants to merge 2 commits into
magic-peach:mainfrom
satyamtiwari-1499:fix/fileupload-single-hidden-input

Conversation

@satyamtiwari-1499
Copy link
Copy Markdown

@satyamtiwari-1499 satyamtiwari-1499 commented May 22, 2026

Summary

Closes #940

This PR fixes duplicate hidden file input elements inside the FileUpload component.

Previously, multiple hidden <input type="file"> elements were rendered across different UI states while sharing the same inputRef. This could cause the ref to point to an unexpected input instance, resulting in inconsistent file picker behavior and redundant DOM elements.

This contribution is submitted as part of GSSoC'26 open source contribution.

Changes Made

  • Consolidated hidden file inputs into a single shared input element
  • Attached inputRef only once
  • Ensured all upload triggers use the same input instance
  • Removed duplicate onChange handlers
  • Added unit tests to verify only one hidden file input is rendered in both upload states

Result

The Change button, dropzone click, and keyboard shortcuts like Ctrl/Cmd + O now consistently open the same file picker with predictable ref behavior and cleaner DOM structure.

Testing

  • Tested locally using bun run dev
  • Verified build passes successfully
  • Added tests for both empty and file-selected states

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

✅ PR Format Check Passed — @satyamtiwari-1499

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @satyamtiwari-1499!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions github-actions Bot added level:intermediate Intermediate level - 35 pts type:bug Bug fix type:testing Testing labels May 22, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@satyamtiwari-1499 is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@satyamtiwari-1499
Copy link
Copy Markdown
Author

/gssoc26

@github-actions github-actions Bot added the type:design UI/UX design label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Intermediate level - 35 pts type:bug Bug fix type:design UI/UX design type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate hidden file inputs in FileUpload component cause ref confusion and redundant DOM

1 participant