'How to show spinner while Safari is converting HEIC to JPEG via <input type=file>

Safari allows you to select HEIC files with

<input type="file" accept="image/jpeg">

and it automatically converts them to JPEG. The conversion could be slow for multiple files on slower machines. I want to fill the waiting time between choosing the files and the firing of the the "onchange" event with a spinner.

I'm able to show a spinner when the user clicks on the input, and hide it when the "onchange" event fires. The problem is that if the user cancels the "Choose files" dialog there is no event.



Solution 1:[1]

This might be useful. It checks if something was added to the input field, i.e. a file was selected or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yusufk