Describe the issue
The built-in "Upload an image" dialog's device-upload field is a plain <input type="file" accept="image/*"> with no capture attribute. On Samsung Internet and iOS Safari, the OS still offers a "camera" option for this input, but on Chromium-based Android browsers (Chrome specifically) the input only opens the device gallery/file picker, with no way to trigger the camera directly. This is inconsistent behavior across mobile browsers for what is meant to be the same "upload an image" action.
Reproduction
The public demo at https://mdxeditor.dev/editor/demo reproduces this too, since it uses the same default image dialog.
To Reproduce
Steps to reproduce the behavior:
- Open https://mdxeditor.dev/editor/demo on an Android phone using Chrome.
- Click the "Insert image" toolbar button.
- In the "Upload an image" dialog, click "Choose File".
- The device gallery/file picker opens directly; there is no option to open the camera.
- Repeat the same steps on the same device using Samsung Internet, or on an iOS phone using Safari: the camera option is offered there.
See attached unwanted_behaviour.gif (Chrome on Android: gallery only) vs. wanted_behaviour.gif (Samsung Internet: camera option available).
| Unwanted (Chrome on Android: gallery only) |
Wanted (Samsung Internet: camera option available) |
 |
 |
Expected behavior
The device-upload field should consistently offer the option to take a photo directly with the camera, regardless of browser. Since this is a common web-platform gotcha (the fix is adding capture="environment" to the file input), it would help if imagePlugin exposed an option to add this attribute to the built-in dialog's file input, e.g.:
imagePlugin({
imageUploadHandler,
captureAttribute: 'environment', // or 'user', or undefined to keep current behavior
})
Screenshots
See attached wanted_behaviour.gif and unwanted_behaviour.gif.
Mobile (please complete the following information):
- OS: Android (issue reproduces), iOS (works correctly)
- Browser: Chrome on Android (issue reproduces); Samsung Internet on Android and Safari on iOS (both work correctly, camera option offered)
Additional context
As a workaround, we added a second toolbar button next to the existing "insert image" button. It uses a hidden <input type="file" accept="image/*" capture="environment">, and on change calls the public insertImage$ signal with the selected file, so it goes through the same imageUploadHandler pipeline as a normal image insert. This reliably opens the camera across Chrome Android, Samsung Internet, and iOS Safari, confirming capture="environment" is the fix.
It would be nice to have this built into the default dialog/plugin options rather than requiring a separate button.
Describe the issue
The built-in "Upload an image" dialog's device-upload field is a plain
<input type="file" accept="image/*">with nocaptureattribute. On Samsung Internet and iOS Safari, the OS still offers a "camera" option for this input, but on Chromium-based Android browsers (Chrome specifically) the input only opens the device gallery/file picker, with no way to trigger the camera directly. This is inconsistent behavior across mobile browsers for what is meant to be the same "upload an image" action.Reproduction
The public demo at https://mdxeditor.dev/editor/demo reproduces this too, since it uses the same default image dialog.
To Reproduce
Steps to reproduce the behavior:
See attached
unwanted_behaviour.gif(Chrome on Android: gallery only) vs.wanted_behaviour.gif(Samsung Internet: camera option available).Expected behavior
The device-upload field should consistently offer the option to take a photo directly with the camera, regardless of browser. Since this is a common web-platform gotcha (the fix is adding
capture="environment"to the file input), it would help ifimagePluginexposed an option to add this attribute to the built-in dialog's file input, e.g.:Screenshots
See attached
wanted_behaviour.gifandunwanted_behaviour.gif.Mobile (please complete the following information):
Additional context
As a workaround, we added a second toolbar button next to the existing "insert image" button. It uses a hidden
<input type="file" accept="image/*" capture="environment">, and on change calls the publicinsertImage$signal with the selected file, so it goes through the sameimageUploadHandlerpipeline as a normal image insert. This reliably opens the camera across Chrome Android, Samsung Internet, and iOS Safari, confirmingcapture="environment"is the fix.It would be nice to have this built into the default dialog/plugin options rather than requiring a separate button.