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

No-text-as-attribute requires translation for empty text #12

Open
alex-pex opened this issue Aug 20, 2019 · 6 comments
Open

No-text-as-attribute requires translation for empty text #12

alex-pex opened this issue Aug 20, 2019 · 6 comments

Comments

@alex-pex
Copy link

alex-pex commented Aug 20, 2019

If I write <img src="icon.png" /> I get img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.eslint (jsx-a11y/alt-text)

But If I change it to <img alt="" src="icon.png" /> I get Untranslated JSX attribute alt with "" eslint(m6web-i18n/no-text-as-attribute)


Maybe no-text-as-attribute should accept empty values, or a list of whitelisted values ?

@mfrachet
Copy link

Accessibility is a thing 😊. My opinion is that it should never be empty.

😁😁😁

@Slashgear
Copy link
Contributor

Can't agree more with @mfrachet

@alex-pex
Copy link
Author

alex-pex commented Aug 22, 2019

If the content that the image conveys is presented within text in the surrounding context of the image, then an empty alt attribute may suffice.

From https://webaim.org/techniques/alttext/#example1 (look at example 2) -- WebAIM (Web Accessibility In Mind) has provided comprehensive web accessibility solutions since 1999.

There are use cases where alt can be empty and still be perfectly accessible. The plugin doesn't allow to do that

@mfrachet
Copy link

Totally agree with this.

There are plenty of sites contradicting each other on that topic.

I only provide you my thoughts and it s up to you to decide : for me it can exist empty alts for only visual elements like something that exist only for animation purpose and that has no meaning at all.

But you may probably talk about your actual need with @Slashgear and share together ☺️

@Gregcop1
Copy link

I think you're wrong.

  • alt="Logo of X Company" is read as "Image : Logo of X Company"
  • missing alt is read as "Image ... (and nothing more)"
  • alt="" is ignored by screen reader.

Maybe you prefer to describe all images but when image have nothing to tell, there's no reason to waste time of people who need screen reader. I don't know if you already try to navigate with screen reader but if no, do it once. You'll see how it's long and boring. With small efforts of devs (like providing smart alt only when it's useful), we can make their navigation easier, so why not helping them ?

@alex-pex
Copy link
Author

I already did the fix on a fork (1 line change), I can submit a PR if you agree with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants