ajax icon indicating copy to clipboard operation
ajax copied to clipboard

Add support for cancel event in file selection input

Open nnmax opened this issue 1 year ago • 1 comments

This PR adds the ability to listen for the cancel event. When the cancel event is fired, the promise is rejected.

Currently, if the user cancels the upload, the promise is always in pending state, which should not make sense.

I am using this great library to implement image upload functionality. Currently I need to listen to the user's cancel action. I'm sure others will have this need as well.

Modern browsers already implement the Input's Cancel event, so it only takes a small amount of code to implement this functionality.

references:

  1. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/cancel_event
  2. https://caniuse.com/mdn-api_htmlinputelement_cancel_event

fixed: #50

nnmax avatar Dec 11 '24 09:12 nnmax

that would be amazing to add this

volodymyr-tomorrow avatar Feb 06 '25 20:02 volodymyr-tomorrow