Skip to content

Commit

Permalink
Ensure HEIC files selectable from “Upload” button (#66292)
Browse files Browse the repository at this point in the history
* Ensure HEIC files selectable from “Upload” button

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

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>

* move “image/heic” addition to FormFileUpload component

* add image/heif

---------

Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: ironprogrammer <ironprogrammer@git.wordpress.org>
Co-authored-by: ndiego <ndiego@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>
  • Loading branch information
8 people authored Nov 4, 2024
1 parent 2a18aae commit c5921d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/components/src/form-file-upload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export function FormFileUpload( {
{ children }
</Button>
);
// @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 (
<div className="components-form-file-upload">
Expand All @@ -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"
Expand Down

0 comments on commit c5921d7

Please sign in to comment.