Skip to content

Commit c5921d7

Browse files
adamsilversteinMamadukaswissspidyironprogrammerndiego
authored
Ensure HEIC files selectable from “Upload” button (WordPress#66292)
* Ensure HEIC files selectable from “Upload” button * Update packages/components/src/form-file-upload/index.tsx Co-authored-by: George Mamadashvili <[email protected]> * move “image/heic” addition to FormFileUpload component * add image/heif --------- Co-authored-by: adamsilverstein <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: swissspidy <[email protected]> Co-authored-by: ironprogrammer <[email protected]> Co-authored-by: ndiego <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: getdave <[email protected]>
1 parent 2a18aae commit c5921d7

File tree

1 file changed

+7
-1
lines changed
  • packages/components/src/form-file-upload

1 file changed

+7
-1
lines changed

packages/components/src/form-file-upload/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export function FormFileUpload( {
4747
{ children }
4848
</Button>
4949
);
50+
// @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files
51+
// from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4.
52+
// This can be removed once the Chromium fix is in the stable channel.
53+
const compatAccept = !! accept?.includes( 'image/*' )
54+
? `${ accept }, image/heic, image/heif`
55+
: accept;
5056

5157
return (
5258
<div className="components-form-file-upload">
@@ -56,7 +62,7 @@ export function FormFileUpload( {
5662
ref={ ref }
5763
multiple={ multiple }
5864
style={ { display: 'none' } }
59-
accept={ accept }
65+
accept={ compatAccept }
6066
onChange={ onChange }
6167
onClick={ onClick }
6268
data-testid="form-file-upload-input"

0 commit comments

Comments
 (0)