Fix for File Selector not being able to select .ged files on mobile devices (#293)

This commit is contained in:
Oktay Comu
2026-05-29 07:39:23 +00:00
committed by GitHub
parent ea66d5027b
commit 60e076fca1

View File

@@ -13,6 +13,14 @@ interface Props {
menuType: MenuType;
}
/**
* On touch devices (iOS, Android) the browser's file picker ignores unknown
* extensions like .ged and may restrict selection to photos when image types
* are listed. Omitting the `accept` attribute lets the OS file browser show
* all files without filtering.
*/
const isMobileDevice = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
/** Displays and handles the "Open file" menu. */
export function UploadMenu(props: Props) {
const navigate = useNavigate();
@@ -84,7 +92,11 @@ export function UploadMenu(props: Props) {
<input
className="hidden"
type="file"
accept=".ged,.gdz,.gedzip,.zip,.webp,image/*"
accept={
isMobileDevice
? undefined
: '.ged,.gdz,.gedzip,.zip,.jpg,.jpeg,.png,.gif,.webp'
}
id="fileInput"
multiple
onChange={handleUpload}