-
Notifications
You must be signed in to change notification settings - Fork 10.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
fix(gatsby-remark-images): captions do not show fallback based on filename #14219
Conversation
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.
First of all--thanks for doing this!
Few things:
- How about a test to validate the functionality? e.g. creating empty alt text with an image and validating that a caption does not appear?
- You had a lint error, I've queued up a job to fix it right up. You may need to pull from your branch, e.g.
git pull origin caption-issues
before making any changes!
Had a chance to fix the linting issues. Will do a test a bit later! |
@DSchau Added a test! EDIT: Seems that there's an issue with the jest snapshot? Is it Windows related or something maybe? |
@DSchau I just reverted the change to the snapshot - Seems to be working fine now! |
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.
Looks great! One final comment, then let's get this merged. Thanks!
There you go! |
Successfully published: |
gatsby-remark-images 3.0.11 (introduced in 7de7ad4) will show alt as caption if no caption is provided, and filename as caption if no alt/caption is provided. gatsbyjs/gatsby#14219 fixed the fallback to filename issue, but still preserves the fallback to alt behaviour. Thus I set showCaptions to false. (`alt` is intended for users cannot see the image. Displaying *alternative* text *alongside* images feels wierd.)
Description
Fixed an issue where captions would show the image filename if no caption/alt was given.
Related Issues
Fixes #14188