Image Block: Show snackbar error notice when HEIC image is added#66368
Image Block: Show snackbar error notice when HEIC image is added#66368AhmarZaidi wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Instead of adding a warning notice, we should probably prevent users from uploading .heic files if their server doesn't support conversion into a web-safe format like jpeg. |
| sprintf( | ||
| /* translators: %s: file name */ | ||
| __( | ||
| 'The image file "%s" is in HEIC format, which is not supported by your browser. Consider converting it to JPEG and re-uploading.' |
There was a problem hiding this comment.
WordPress automatically does this conversion for uploaded HEICs when the server supports it.
|
Thanks for the PR, @AhmarZaidi! Though I agree with Adam's comment that preventing [future] HEIC uploads on an unsupported server would be preferable goal. This snackbar would have been a great addition if part of 6.7. However, by the time this update would ship in Core with 6.8, it's likely that it will be more difficult for users to get into this situation. #66293 is more about warning users that their existing inserted HEIC image is problematic. The placeholder itself looks wonky and doesn't clarify that most users won't be able to view the image. |
|
This has been resolved via WordPress/wordpress-develop#7629. |
Fixes part of: #66293
What?
This PR adds a 'snackbar' error notice for HEIC image uploads.
Why?
When an HEIC file is uploaded to a server that does not support HEIC to JPEG conversion, and the browser (such as Chrome or Firefox) does not support displaying HEIC, users see the alt text 'This image has an empty alt attribute; its file name is ...', however if we upload an HEIC image from the Media Library.
How?
Added an error notice of type 'snackbar' on image error after checking if the uploaded image is HEIC type.
Testing Instructions
core/imageblock.Testing Instructions for Keyboard
N/A
Screenshots or screencast
Screen.Recording.2024-10-23.at.5.11.51.PM.mov