-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
[Form] file input styles #105
Comments
Any preferences or ideas where we can probably adopt the functionality from an existing open source library? https://www.sitepoint.com/10-jquery-file-uploads/ lists the (even today) most used libraries afaik. |
@lubber-de We had a talk about making the upload input into a module instead of just a style in the form. Therefore we can make drag and drop support along with some nice functions for doing uploads. |
At this point even a simple style would be sufficient. Anything is better than nothing at all. 🙂 |
The absolute minimum is only to hide the file input element itself, as you can design your fileupload button using form labels as you desire for the time being <form class="ui form">
<label for="textupload" class="ui icon button">
<i class="file icon"></i>
Open any file
</label>
<input type="file" id="textupload" class="ui file input">
</form> .ui.file.input {
display: none;
} |
@hammy2899 @lubber-de I can take this one. What would be the acceptable PR for this? |
@aexvir Go for it 👍 We just want basic styles for the file input button like the comment from @lubber-de above |
@aexvir We want to add this as a module but adding the styles will be a start. |
Alright, so I'll go just for styles on the first PR and afterwards we can make an issue for adding more functionality to it, with specific requirements that will be added as another PR. Does that make sense? |
@aexvir Yeah that's fine 👍 |
So... I'm not that sure about this tbh. I can't get anything much better than @lubber-de 's solution, which is literally just a three line code change, as all the work is done in the label and not the input itself. Webkit does allow some more fantasy with the input styling but I don't think that's an acceptable solution. For all the rest of the stuff we'll need javascript, even for the basic stuff as showing the uploaded filename. Should I just submit the PR with this three line change for hiding the file input? If not, let's define a specification for the upload input, which features we'd like to have from the beginning and I'll work on that. |
I use the following method. <div class="ui grid">
<div class="column">
<label class="file-upload">
<input name="file" type="file" id="files" class="file-input">
<span class="ui button">Choose file</span>
</label>
</div>
</div> .file-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
outline: 0;
width: 100%;
height: 100%;
} |
This may not be accessible - I am not able to use the keyboard with this solution. |
This will also attempt to select the file when you click anywhere next to the button unless you set @lubber-de already suggested the better method. |
You mean https://jsfiddle.net/jsagx3v9/1/? That one isn't keyboard accessible either. I'm trying to figure out if I can make it be though. |
@andrewleith No. I am not talking about keyboard accessibility. The method @ioOiOiOoi will trigger the file input by clicking anywhere next to the label as the same height as the label. |
@andrewleith Here is the same fiddle but now it's accessible to keyboard strokes 🙂 |
Amazing! Thank you! |
File input styling is now prepared by #2145 |
Add file upload input styles as mentioned here Semantic-Org/Semantic-UI#403, would also be cool to implement as a module and have drag & drop functionality.
The text was updated successfully, but these errors were encountered: