-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat(InputFile): multipleでファイルを追加していけるように変更 #5281
base: master
Are you sure you want to change the base?
Conversation
commit: |
メモ: レビューしやすいように変更を最小限にした |
|
||
if (multiple) { | ||
// multipleの場合、すでに選択済みのファイルと結合する | ||
updateFiles([...files, ...newFiles]) |
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.
この仕様は議論の余地がありそう。
Chromeなどのブラウザ実装では
- 一度目に選んだファイルは、二度目に選ばれたファイル群と結合されない
つまりイメージとしては都度渡された配列を結合するのではなく、常に上書きされます。
個人的にはmultipleを実装するならブラウザデフォルトの動きに合わせたいです。
もしユースケースとして結合させたい場合があるなら、属性名はmultiple以外にしたいです(最終的にinput[file][multiple]が出力されるとしても、デフォルトではない挙動をするなら、コンポーネントとしての属性は別の名前
にしておいたほうが事故はすくなるなるかと...)
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.
なるほどです!ユースケース的にはこの挙動自体は以前定例で話した通り、他のプロダクトでもある認識です〜
props名はたしかに感あるので、 multiple
& appendable
のときにこの挙動をする、とかだとどうでしょう?
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.
↑良さそう
ただ実際問題として multiple
だけで設定することがないような気がする...
雑ですが multiAppendable
みたいな1属性で設定してもいいかもですね...
関連URL
概要
InputFileでmultipleのときにファイルを追加していけるようにした
変更内容
確認方法
以下をsandbox内などにおき試してみる