Skip to content

feat(react): new component FileUpload#4540

Draft
oddvernes wants to merge 37 commits intomainfrom
feat/fileupload
Draft

feat(react): new component FileUpload#4540
oddvernes wants to merge 37 commits intomainfrom
feat/fileupload

Conversation

@oddvernes
Copy link
Copy Markdown
Collaborator

resolves #1236

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 24, 2026

⚠️ No Changeset found

Latest commit: 1392825

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

Preview deployments for this pull request:

storybook - 27. Mar 2026 - 09:55

www - 27. Mar 2026 - 10:01

@oddvernes oddvernes changed the title feat(react): FileUpload new component feat(react): new component FileUpload Feb 24, 2026
@oddvernes
Copy link
Copy Markdown
Collaborator Author

One issue I have encountered: because all the components are in one common @layer, placing FileUpload inside a Field causes .ds-field to overwrite styles on .ds-file-upload (being a label) due to usage of stronger selectors (:is()). For now I have solved this by repeating the class twice .ds-file-upload.ds-file-upload {} to get same specificity (0.2.0) and then it wins by being later in the css order.

@Febakke
Copy link
Copy Markdown
Member

Febakke commented Mar 3, 2026

Tested with VoiceOver.

Label in field gives weird behavior. Image is showing reading order of elements.
Skjermbilde 2026-03-03 kl  09 12 16
Image from screen reader:
test

Text inside works fine:
Skjermbilde 2026-03-03 kl  09 14 10

We need to discuss:

  • Should we support label outside of dropzone? If so, how do we create a robust screen reader experience?
  • We need to think about the "slipp filer her" text. This is something we might want to hide from screen readers. How do we support this and flexible texts 🤔

@eirikbacker
Copy link
Copy Markdown
Contributor

Pushed some updates now:

  • Screen reader tested 👍
  • Moved from label to description for all text
  • Question: should readonly really be same visually as hover?
  • Question: should :hover really change button styling too? (this makes it harder for end user to change to ie. primary button)
  • Question: should FileUpload.Button be renamed to FileUpload.Trigger or FileUpload.CTA or something, as Button sets expectations of a HTML <button> but we are rendering a <span>? ☺️
  • Question: there is a lot of aria-hidden="true" on the description texts in the stories - are we sure we want to hide this text from screen readers? I see why it might feel redundant, but in the same time - we should strive to have the same information accessible for everyone

@Febakke
Copy link
Copy Markdown
Member

Febakke commented Apr 15, 2026

@eirikbacker Thanks for excelent feedback as always! ❤️

  • Question: should readonly really be same visually as hover?

Good point. I made some changes so we align more with Nav Aksels design on this. Not solid border and a grey background. We need to decide if we want it to follow data-color or not. I might be leaning on always using the neutral scale as it follows how we solve or other read-only components.
Skjermbilde 2026-04-15 kl  09 22 01

Here is an example if we would follow data-color with a blue color.
Skjermbilde 2026-04-15 kl  09 23 31

  • Question: should :hover really change button styling too? (this makes it harder for end user to change to ie. primary button)

This is not important to me. We have a pretty "heavy" hover state with both background and changes to border. Having the button be static I think is okay.

  • Question: there is a lot of aria-hidden="true" on the description texts in the stories - are we sure we want to hide this text from screen readers? I see why it might feel redundant, but in the same time - we should strive to have the same information accessible for everyone

Im guessing you are referring to hiding the "Slipp filer her" text. We based this on some user tests that the american design system had done on screen reader users. But we do not have any first hand data on this. If you think its better to make all text available, thats fine by me. One reason why I dont push back on this is meant to be changed by our consumers. So lets say they remove the "label" and add the text. "Drop you application here or choose file" then important information would be hidden from screen readers if aria-hidden="true" is standard. Might be safer to just let all text be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New component: Fileupload

3 participants