-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
input-file: create a plugin #31085
input-file: create a plugin #31085
Conversation
25ecae6
to
48f93a6
Compare
48f93a6
to
dc6f45e
Compare
site/content/docs/5.0/forms/file.md
Outdated
{{< callout info >}} | ||
The recommended plugin to animate custom file inputs is [bs-custom-file-input](https://www.npmjs.com/package/bs-custom-file-input); it's what we use here in our docs. | ||
{{< /callout >}} | ||
|
||
## Default | ||
|
||
The file input is the most gnarly of the bunch and requires additional JavaScript if you'd like to hook them up with functional *Choose file...* and selected file name text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need to be reworded since it won't require extra JS, but our plugin :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have any ideas do not hesitate 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, not sure if this should be listed as a component or not (probably not)
@mdo please have a look and let us know :)
34f421f
to
05cc51b
Compare
e6a14df
to
fdaccc5
Compare
Any idea when this would be ready for review? |
@mdo this is ready but please check out the comments above. |
|
||
#### Via data attributes | ||
|
||
Activate a file input without writing JavaScript. Set `data-toggle="file-input"` on a `.form-file` element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-toggle
doesn't feel right since we're not exactly toggling something. Not sure what else do to just yet though either, so open to ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like: data-enable
?
<button id="btnResetFormFileInput" class="btn btn-primary mt-3"> | ||
Reset form | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be moved inside the form with type="reset"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep the place doesn't really matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still pending AFAICT @Johann-S :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if @mdo would like to tackle that or not
Any reason @mdo it shouldn't be in Alpha 2 ? There are comments which are waiting for you here, and after those fixes it should be good to go |
ce55fbc
to
8352b7b
Compare
8352b7b
to
d41cc44
Compare
js/src/file-input.js
Outdated
// Public | ||
|
||
dispose() { | ||
[window, this._element].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to remove the forEach call here since we only have 2 calls?
FWIW, next week (October 20th), Firefox 82 will ship. This version will support the ::file-selector-button pseudo element. Webkit has been supporting This means we style file inputs without any JS, see https://codepen.io/MartijnCuppens/pen/VwjvXpe?editors=1100 |
@MartijnCuppens our target browsers aren't just Chromium latest, though. |
@XhmikosR, |
Closing for #31955. |
Demo: https://deploy-preview-31085--twbs-bootstrap.netlify.app/docs/5.0/forms/file/
Edit:
Closes #30265