Skip to content
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: make img alt attribute empty #1860

Merged
merged 6 commits into from
Oct 6, 2020
Merged

Conversation

motou
Copy link
Contributor

@motou motou commented Oct 1, 2020

Closes #1819

set the image alt attribute empty so that screen reader won't annonce the text twice.

Changelog

Changed

@vercel
Copy link

vercel bot commented Oct 1, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carbon-design-system/carbondesignsystem/1heb77bf5
✅ Preview: https://carbondesignsystem-git-2b32751df4854799f48ac960e8260e911acd1be7.carbon-design-system.vercel.app

@jaknas
Copy link
Contributor

jaknas commented Oct 1, 2020

correct me if I'm wrong, but I think ![](image) syntax erases alt tag altogether and this is not ideal, the desired behaviour is to have alt="" [1] according to decorative images spec.

IMO this is some constraint on gatsby-remark-images plugin as they don't allow for null alt text as far as I know.

[1] https://www.w3.org/WAI/tutorials/images/decorative/

@tw15egan tw15egan self-requested a review October 1, 2020 17:00
@tw15egan
Copy link
Collaborator

tw15egan commented Oct 1, 2020

@Kleyu nice catch! You are correct, seems like this is currently not possible (passing in an alt="") due to Gatsby setting a default value if one is not passed. Looks like we'll need to get this fixed upstream before we can fix it on our end.

Issue: gatsbyjs/gatsby#20179
Gatsby source: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-images/src/index.js#L173

@motou
Copy link
Contributor Author

motou commented Oct 1, 2020

@Kleyu nice catch! You are correct, seems like this is currently not possible (passing in an alt="") due to Gatsby setting a default value if one is not passed. Looks like we'll need to get this fixed upstream before we can fix it on our end.

Issue: gatsbyjs/gatsby#20179
Gatsby source: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-images/src/index.js#L173

Okay, then let me fix that issue at first 🙃

the keyword GATSBY_EMPTY_ALT is used to generate an img tag with empty alt attribute
so that the fix for creating empty alt attribute can be used
@motou
Copy link
Contributor Author

motou commented Oct 2, 2020

@tw15egan thanks for approving. The fix PR gatsbyjs/gatsby#27218 is already merged. When the new version 3.3.33 is published, then this PR is ready to be merged as well.

@pieh
Copy link

pieh commented Oct 2, 2020

IMO this is some constraint on gatsby-remark-images plugin as they don't allow for null alt text as far as I know.

(I'm maintainer of gatsby-remark-images). The behaviour like that (falling back to filename as alt) was unfortunate choice in the past, that I hope to remove in the next major release (probably will have a way to maintain that behaviour for anyone that wish to keep it). There is also opportunity to add global plugin setting to disable this behaviour in current major version line too (without causing breaking changes and forcing major version bump just yet)

@tw15egan
Copy link
Collaborator

tw15egan commented Oct 2, 2020

@pieh @motou thanks for working together so quickly to tackle this! 🙏 🥇

@motou
Copy link
Contributor Author

motou commented Oct 6, 2020

@tw15egan since the new version 3.3.33 is already published (gatsbyjs/gatsby#27218 (comment)), this PR is ready to be merged :)

@andreancardona
Copy link
Contributor

@motou yay! 🥳 thanks for the contribution!

@kodiakhq kodiakhq bot merged commit 140c88a into carbon-design-system:master Oct 6, 2020
natashadecoste pushed a commit to natashadecoste/carbon-website that referenced this pull request May 19, 2021
* fix: make img alt attribute empty

* fix: use GATSBY_EMPTY_ALT keyword

the keyword GATSBY_EMPTY_ALT is used to generate an img tag with empty alt attribute

* chore: update gatsby-remark-images version

so that the fix for creating empty alt attribute can be used
natashadecoste pushed a commit to natashadecoste/carbon-website that referenced this pull request May 19, 2021
* fix: make img alt attribute empty

* fix: use GATSBY_EMPTY_ALT keyword

the keyword GATSBY_EMPTY_ALT is used to generate an img tag with empty alt attribute

* chore: update gatsby-remark-images version

so that the fix for creating empty alt attribute can be used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

audit-avt1-data-viz-types: link text repeated
5 participants