Choose File not responding
Closed this issue · 3 comments
The ARC testing interface does not load a file if it was loaded before selecting a random task.
To replicate, perform the following twice:
- Click "Random task"
- Click "Choose File" and select a file (must be same file both times)
The last step should load the selected file, but instead does nothing.
Indeed, probably, looking into it now.
Loading the same file multiple times using the file input will only trigger a "change" event the very first time, so the following code only runs once when you load the same file over and over again:
$('.load_task').on('change', function(event) {
loadTaskFromFile(event);
});
This means that if the user loads a task file, then tweaks it, then tries to load it again, nothing will happen.
The best solution I could find is to clear the file input when it is clicked, and also when a random task is successfully loaded (see PR #22). I just set the file input's value to an empty string: I believe this works in all recent browsers, but I just tested with the latest Chrome and Safari.