apache / apache/cordova-plugin-camera
"Choose file" button not removed when file selector is canceled.
- Dominant language
- Objective-C
- Stars
- 976
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
While running an app built for electron platform (same issue on browser platform too) using the plugin and choosing to select from file it adds "Choose File" button to the app. When pressed it opens a file selector allowing to select a file. If we press "Cancel" on the dialog then the dialog is closed but "Choose File" button remains within the DOM with no callbacks called. So the only way to remove it is to actually choose a file.
### What is expected to happen?
* Either one of the callbacks to be called so we can manually remove `input` element from the DOM.
* Or `input` element removed from the DOM by the plugin.
### What does actually happen?
* `input.cordova-camera-select` element remains within the DOM.
### Command or Code
`navigator.camera.getPicture(val => console.log(val), err => console.error(err), { quality: 50, destinationType: 0, sourceType: 0, correctOrientation: true });`
### Environment, Platform, Device
- Electron and Browser platforms
### Version information
- MacOS 10.15.5
- Cordova 9
- `"cordova-plugin-camera": "^4.1.0"`
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start at the navigator.camera.getPicture call and trace the file-selection flow for the Electron and Browser platforms, focusing on the input.cordova-camera-select element after cancellation. Reproduce the Cancel case and verify that either an error callback fires or the input is removed from the DOM without selecting a file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100