Skip to content

[FileUploader]: missing/inconsistent file validation #21166

@kennylam

Description

@kennylam

The problem

The FileUploader components have inconsistent and sometimes duplication validation.

The solution

File validation should be made consistent for all uploader components which require it. Since there are at least two already identified, it makes sense to extract all validation logic into a shared utility.

Examples

The default FileUploader story states that only jpg file types are allowed, but this is UI-level filtering only. Users can bypass by selecting 'all files' in the file dialog. There is no JS validation for file types.

The drag and drop story correctly displays a validation error when invalid file types are added.

Design impact

Yes, visual design

Documentation impact

  • The website documentation (carbondesignsystem.com)
  • Figma kit documentation
  • Storybook(s) documentation
  • I'm not sure

Package

@carbon/react

Application/PAL

Carbon Design System

Business priority

Low Priority = release date is not dependent on fix or not upcoming

Available extra resources

No response

Code of Conduct

Metadata

Metadata

Assignees

No fields configured for Enhancement.

Projects

Status
🪆 Needs Refined
Status
Later 🧊

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions