-
-
Notifications
You must be signed in to change notification settings - Fork 768
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Input #118
Comments
Our team (@kaiszybiak, @preethivenkatesh-sdase, @janborkensteinm, @mkitzmann) prepared a proposal for file input components. We are looking forward to your feedback and would like to discuss the next steps. We suggest to build 4 separate components:
These components could be used individually or composed together (see animation below). Dropzone.Animation.movDropzoneDropzones are areas into which files can be dragged and dropped to upload a file. It might be worth looking into if we could utilize an existing library here like https://github.com/dropzone/dropzone. There has also been some similar work done in Adobe Spectrum Web Components. Properties
Events
Slots
CSS Custom Properties
CSS Parts
DependenciesThis component imports the following dependencies.
FileListA file list provides a list of files and is composed of FileListItem components. Events
Slots
CSS Parts
FileListItemFile list items represent an uploaded file and provides information about file type, file size etc. Properties
Slots
CSS Parts
DependenciesThis component imports the following dependencies.
FileInputFile inputs can be used to upload one or more files from the local file system. This could be a separate component or extend the default input component. Its properties should align with the native file input, so it can be used in forms (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) Properties
Events
Slots
CSS Parts
DependenciesThis component imports the following dependencies.
|
We would like to prepare a PR for these components in the next couple of weeks. So it would be great to know if this is something that would be of interest to the community. |
At first glance, this looks really good and well thought out. Unfortunately, it was submitted the first day of my vacation so I won’t be able to give it a proper review until I get back next week. However, separate PRs would be better so we can keep each one focused and get them merged faster. Thanks for contributing this, and apologies for the delay. I can’t wait to get home and review it! |
Dropzone / FileList / FileListItemApologies for the delay. I'm really liking Dropzone, FileList, and FileListItem. It looks like FileList and FileListItem aren't listed as dependencies of Dropzone — in that case, is the user expected to listen for events and populate the FileList themselves? I was thinking it would be automatic, and I'm not sure if that's what you're intending or not. In other words, users would ideally be able to do this: <form>
<sl-dropzone ...></sl-dropzone>
</form> And everything just works. Of course, they can listen to events and do other custom things as needed, but the default behavior should submit files like a regular file input and allow them to add/remove files without having to code anything custom for it. If that's the intention, it would make sense to bundle the three of these components into a single PR since they're designed to work in tandem. At that point, we can dive into the API a bit more. (At a glance, I don't have any major concerns with the proposed API.) I like the names you've chosen, but I'm worried that "Dropzone" is a bit disconnected from its dependents. It will be harder for users to discover it. I'm wondering if calling it "FileDropzone" would help with that. Do you already have these working? I'm not sure if the video is a mock or if it's showing actual components. It looks good, though! FileInputThe design here seems to be inspired by the browser's default file input, which I'm not a fan of. I wonder how we can improve the aesthetics while keeping it intuitive. I think it's a combination of the button + input that makes it seem...maybe outdated? The API looks pretty good. I'd suggest a few changes:
Next StepsI'd love to see a PR for Dropzone, FileList, and FileListItem. This is a really intuitive approach to file uploads and I'm excited to dive in deeper and play with the APIs. I'm sure I'll have more feedback once I see it them action! With those components, do we even need a separate FileInput? It seems redundant to have both, and I question whether we can get the same level of UX in FileInput as we have in Dropzone. One common alternative — and something that Shoelace v1 had, is a FileButton. This is just a simple button that, when clicked, opens the system upload dialog and emits an event with the selected file(s). It's less featureful compared to the proposed FileInput, but I've found it useful for many applications (e.g. selecting an avatar, one-click uploads) and may be enough to fill the gap between a simple file input and a full-featured Dropzone. |
Thanks for the feedback @claviska! It sounds like a good idea to drop the FileInput component. It would probably just be a more "compact" version of the Dropzone and FileList without that same level of usability. The FileButton could actually be a feature of the Dropzone, since that is pretty much the same functionality just styled differently. So maybe we could add a The Dropzone should definitely just work without needing to handle the FileList manually. We will extend the list of dependencies. Maybe it should have a We can prepare a PR for |
Just chiming in to say I'm very excited about this. Working with dropzones/multiple file uploads with progress has always been pretty tricky, even with battle-tested well-known libraries. And I don't know of any in the WC space. I'll definitely be able to make good use of this! |
We started working on this and will contirbute it once we have a first "stable" version! |
I'd love to provide feedback as you go. That will make it easier to keep the PR inline with Shoelace's quality standards for code, APIs, etc. Do you have a preview branch anywhere? I'm more than happy to provide feedback as you go! |
Happy to receive the feedback - especially since it is our first component. I think we should have something worth the feedback end of this or beginning of this week! |
This spec is huge! For accessible file input buttons yoou need "only" the FileInput. It is the only element anyway that will work with keyboards and screen readers. The fancy designs look good, but will need some to work with anything but a mouse. @petergrau Has any work been done? |
@masi There's an early proof of concept for a simpler [incomplete] version you can find here. Also note that you can continue to use |
I have my own code, but no web component, that adds some a11y features (my main concern) and a bit of styling. I am worried by the design mockups that the end result is a an all singing and dancing horror for screen reader (and keyboard) users. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Native file inputs currently work with
<sl-form>
, but it would be nice to have a more intuitive file input component. Perhaps something that shows each file as a clearable tag after the user makes a selection. Not sure on the UI, but features should include:accept
propmultiple
propPlease vote for this feature using 👍 or 👎
The text was updated successfully, but these errors were encountered: