Closed tcurdt closed 1 year ago
Current behaviour:
IgnoreAltMissing
is setIgnoreAltMissing
is setWasn't quite sure of the best solution for this but after a bit of reading I've come to this conclusion:
IgnoreAltEmpty
IgnoreAltMissing
is setI'm undecided on whether IgnoreAltEmpty
should be enabled by default. I'm leaning towards no. This both preserves existing behaviour and makes user think about what they're doing.
Some articles for future reference:
I'm undecided on whether IgnoreAltEmpty should be enabled by default. I'm leaning towards no. This both preserves existing behaviour and makes user think about what they're doing.
I agree with that - but IMO also the context matters.
IIUC these are very general options while the figcaption
seems to be a very specific situation.
But I would only want to allow empty/missing alt
attributes in this very case.
Context does matter and this extends beyond the usage of figcaption
. An intentional empty alt tag can be valid in a few contexts. The two I know of:
figcaption
and the alt text would be the same as the caption.Both require a conscious decision to omit the alt text. I had two options in mind. Am a little undecided.
Look for a data-htmltest-allow-missing-alt
(or similar name) attribute which would disable the check, would look like:
<img src="..." alt="" data-htmltest-allow-empty-alt />
<img src="..." data-htmltest-allow-missing-alt />
This is very similar to the data-proofer-ignore
attribute we already have that just disables every check on a tag.
alt=""
as the indicator combined with IgnoreAltEmpty
My initial thought. An empty alt attribute can be a marker of intent. If you intentionally produced <img src="..." alt="" />
then we can allow it.
Thinking about this now you could very easily produce that tag from a faulty templating system which is what this tool is used to catch! I'm now less fond of this idea.
In my case the img
is being generated by a markup conversion. So the data-htmltest-allow-missing-alt
wouldn't really work for me. But on the other hand I wouldn't want to allow empty alt
attributes everywhere.
It seems in a situations where there is a related/sibling
figcaption
thealt
attribute may be OK to be left empty forimg
tags.https://stackoverflow.com/questions/58447538/accessibility-difference-between-img-alt-and-figcaption
It probably should be configurable whether that situation is considered an error or not.