Eslint-plugin-jsx-a11y: Rule proposal: alt text max length

Created on 12 Jun 2017  Â·  5Comments  Â·  Source: jsx-eslint/eslint-plugin-jsx-a11y

Some screen readers will not read alt text if it is too long, or they will break it up in confusing ways. It would be nice to have a rule to help prevent this. I've seen different recommendations, usually somewhere around 100 – 150 characters.

discussion help wanted new-rule

All 5 comments

This may be a little outdated, but it says JAWS partitions it at 125 characters. We can make that default

This is probably going to be difficult to test with lint. I'd imagine the alt attribute value will be assigned via variable in most cases. We'll probably not end up with many cases where this rule would apply.

The rule, however, would be a good basis for a propType/flow type that did a runtime check

@jessebeach we can make sure to only test for literal string values and can include this in the alt-text rule without having the baggage of adding another rule. it could help people working on static sites.

it could help people working on static sites.

Fair point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlmeroSteyn picture AlmeroSteyn  Â·  5Comments

almadsen picture almadsen  Â·  6Comments

pixieduhst picture pixieduhst  Â·  3Comments

chemitaxis picture chemitaxis  Â·  6Comments

astorije picture astorije  Â·  3Comments