mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-18 01:31:47 +00:00
Fix for File Selector not being able to select .ged files on mobile devices (#293)
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user