EmberDroplet icon indicating copy to clipboard operation
EmberDroplet copied to clipboard

Can't Change Files With SingleInput

Open timkendall opened this issue 9 years ago • 0 comments

Background (May not be relevant):

I have a Droplet.SingleInput nested in a Droplet.Area. I am hiding the SingleInput so I can have a custom styled input. I trigger clicks on the input like so to bring up the file dialog:

chooseFile () {
  const fileInput = this.$('input[type=file]');
  fileInput.trigger('click');
}

Issue:

The issue is that once a user has selected a file through the input (rather than drag-n-drop), x-droplet doesn't recognize subsequent selections through the input (validFiles is empty). Drag-n-drop works fine.

I fixed this by manually clearing input.files on the didDelete hook like so:

didDelete () {
  const fileInput = this.$('input[type=file]');
  fileInput.val('');
 },

After doing this x-droplet will recognize when a new file is added through x-droplet-input. This may not be an EmberDroplet bug but I wanted to report it just in case.

Using Ember 1.13.7 and EmberDroplet 2.1.3.

timkendall avatar Nov 06 '15 01:11 timkendall