Skip to content

fix: native file input - #260

Open
atakanbayrak wants to merge 1 commit into
mainfrom
fix/native_file_input
Open

atakanbayrak wants to merge 1 commit into
mainfrom
fix/native_file_input

Conversation

@atakanbayrak

@atakanbayrak atakanbayrak commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • 🆕 New Component
  • ✨ Feature / Enhancement
  • 🐛 Bug Fix
  • 💥 Breaking Change
  • 📦 Build / Dependency / Docs Update
  • 🧹 Code Refactoring

Screenshots / Preview

Checklist

  • Self-reviewed, no leftover logs or debug code
  • Uses design tokens — no hardcoded style values
  • Accessible (keyboard nav, ARIA, contrast)
  • Tests added/updated and passing
  • Storybook story added/updated

How to Test

@claude

claude Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @atakanbayrak's task in 29s —— View job


Review of #260: native file input

I read the full diff and applied docs/review/general.md and docs/review/tests.md. There are no .scss or generated token changes, so the CSS, Figma and design-token rules don't apply. I didn't run tests, tsc or lint, since CI covers them. I found no blocking issues.

What the PR does: native is a new discriminated-union prop (UploadRequestProps | UploadNativeProps). When it's set, the component skips upload and delete requests, the upload button, and auto-upload. It keeps the valid files in the hidden <input type="file"> through DataTransfer, so a native form submit sends them.

Notes (non-blocking)

  1. UploadProvider.tsx (the "keeps its input's files in step" useEffect): it has no dependency array, so it runs on every render. It compares file-key strings each time, which is cheap for small lists. Giving it deps (native, selectedFiles) would still be clearer.
  2. UploadProvider.tsx (same effect, typeof DataTransfer === "undefined" fallback): the fallback only clears the input when the list is empty. If a file is removed from a multi-file selection, the input keeps the removed file and a native submit would still send it. This only matters in environments without DataTransfer (e.g. jsdom), but the behaviour differs from the real path, so tests that rely on it may pass for the wrong reason.
  3. UploadInput.tsx and UploadDragger.tsx: with native, defaultValidations becomes undefined. Files that fail the client check (size or type) are excluded from the input, but nothing blocks the form submit, so the user can submit without the rejected file and get no form-level error. Please confirm this is intended. If it isn't, keep a validation for check-failed files in native mode.
  4. UploadDragger.tsx: there is a stray blank line inside the props={{ ... }} object, between messages, and customValidation,.
  5. The baseline types.ts files intersect UploadProps & UploadRequestProps, which pins them to the request variant. That looks deliberate for the token comparison, and ImageUpload doesn't offer native. A one-line comment in the baseline files would stop someone "fixing" it later.

Breaking-change check: uploadRequest and deleteRequest stay required unless native: true, so the public API remains backward compatible. Stories document native with a default of false, and tests were added for UploadInput, UploadList and UploadDragger.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Size Change: +565 B (+0.2%)

Total Size: 284 kB

📦 View Changed
Filename Size Change
dist/index.cjs 142 kB +279 B (+0.2%)
dist/index.es.js 140 kB +286 B (+0.2%)
ℹ️ View Unchanged
Filename Size
dist/chunks/useToggle-1pe2WRaw.js 800 B
dist/chunks/useToggle-B6kbi656.cjs 769 B
dist/hooks.cjs 225 B
dist/hooks.es.js 219 B

compressed-size-action

@atakanbayrak atakanbayrak self-assigned this Dec 3, 2026

This branch is waiting to be deployed

1 waiting deployment
development — c2c1f049 Waiting Dec 3, 2026 by atakanbayrak via Chromatic #591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant