-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Block: Show snackbar error notice when HEIC image is added #66368
base: trunk
Are you sure you want to change the base?
Image Block: Show snackbar error notice when HEIC image is added #66368
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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/image
block.Testing Instructions for Keyboard
N/A
Screenshots or screencast
Screen.Recording.2024-10-23.at.5.11.51.PM.mov