From c5921d766c143ef6774c827c8c2f6322b2b26b6b Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Mon, 4 Nov 2024 02:30:43 -0700 Subject: [PATCH] =?UTF-8?q?Ensure=20HEIC=20files=20selectable=20from=20?= =?UTF-8?q?=E2=80=9CUpload=E2=80=9D=20button=20(#66292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ensure HEIC files selectable from “Upload” button * Update packages/components/src/form-file-upload/index.tsx Co-authored-by: George Mamadashvili * move “image/heic” addition to FormFileUpload component * add image/heif --------- Co-authored-by: adamsilverstein Co-authored-by: Mamaduka Co-authored-by: swissspidy Co-authored-by: ironprogrammer Co-authored-by: ndiego Co-authored-by: afercia Co-authored-by: getdave --- packages/components/src/form-file-upload/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/components/src/form-file-upload/index.tsx b/packages/components/src/form-file-upload/index.tsx index 0600e47d7324c3..66f0b2ea6d6480 100644 --- a/packages/components/src/form-file-upload/index.tsx +++ b/packages/components/src/form-file-upload/index.tsx @@ -47,6 +47,12 @@ export function FormFileUpload( { { children } ); + // @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files + // from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4. + // This can be removed once the Chromium fix is in the stable channel. + const compatAccept = !! accept?.includes( 'image/*' ) + ? `${ accept }, image/heic, image/heif` + : accept; return (
@@ -56,7 +62,7 @@ export function FormFileUpload( { ref={ ref } multiple={ multiple } style={ { display: 'none' } } - accept={ accept } + accept={ compatAccept } onChange={ onChange } onClick={ onClick } data-testid="form-file-upload-input"