#microformats 2023-10-17

2023-10-17 UTC
gRegor joined the channel
#
angelo
MDN says `alt=""` "indicates that this image is *not* a key part of the content" and https://github.com/microformats/microformats2-parsing/issues/2#issuecomment-372150186 adopted the importance of that explicit behavior
#
Loqi
[preview] [kartikprabhu] Absence of `[alt]` is different from `[alt=""]` https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Omitting%20this%20attribute (fragmentioned URL) So I suggest the following modification to @gRegorLove 's suggestion - else if `img.u-...
[tw2113] joined the channel
#
[tw2113]
that's been my general understanding, empty attribute is better than no attribute, and empty attribute is best for decorative-only images that have no real importance
#
angelo
but if the image has been marked up with u-photo doesn't that imply that it *is* a key part of the microformatted content and thus keeping the alt="" is no longer useful/helpful?
#
angelo
put another way, is there a case where one might ignore or demote a u-photo with an explicit alt=""?
#
[tw2113]
dunno on that part
#
[tw2113]
at least definitively.
#
[tw2113]
that said, how many decorative-only images are you marking up with microforrmats?
#
angelo
precisely my point. current parsing rules dictate that we keep alt="" and include it in the mf2json and i'm questioning that choice.
gRegor joined the channel
#
gRegor
Not sure I understand. I wouldn't expect an alt="" to make a parser ignore an image.
#
gRegor
I think the goal is to preserve what was authored, so a consumer could recreate the img tag from the parsed mf2
#
gRegor
I know HTML validators have reported lack of alt attribute as an error for a while (some exceptions in https://html.spec.whatwg.org/multipage/images.html#guidance-for-conformance-checkers). That MDN page has been updated to not refer to omitting it since that github discussion
#
The_Decryptor
A purely decorative image should be marked up with https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role just using an empty alt attribute is a mistake on the authors behalf
#
angelo
i think i was unclear. current parsing rules dictate that we parse <img src=foo.jpg alt=""> to [{"value": "foo.jpg", "alt": ""}]. i think we should just return ["foo.jpg"].
#
angelo
from a mf2json perspective i'm not sure there's anything to gain from keeping the empty alt text.
#
angelo
what is the case where a consumer is recreating the image with an alt=""? and the consumer could always do that without the {"alt": ""} in the mf2json.
#
sknebel
what is to gain from not keeping the alt-text?
#
angelo
compactness?
#
angelo
there may be a number of reasons why an empty alt tag might be added to the source document
#
angelo
especially if conformance checkers will increasingly flag missing alt text
#
[tantek]
gRegor is correct about roundtripping what was authored
#
[tantek]
Angelo, the trivial example is when a visible image caption outside the image already describes it. In this case, it is better to explicitly mark the alt empty than duplicate such information.
#
[tantek]
Feel free to add those to an FAQ ^
sebbu2, [jamietanna], [jeremycherfas], [benatwork], jeremycherfas and [KevinMarks] joined the channel
#
angelo
I don't follow the example
[campegg] joined the channel
#
[tantek]
if the text you would put in the alt attribute is already present in the "visible to everyone" HTML, then you should avoid duplicating it in the alt text and thus explicitly specify alt=""
#
angelo
in the same section linked by gRegor https://html.spec.whatwg.org/multipage/images.html#guidance-for-markup-generators it says "implementers should either set the alt attribute to the empty string, under the assumption that the image is a purely decorative image that doesn't add any information but is still specific to the surrounding content, or omit the alt attribute altogether, under the
#
angelo
assumption that the image is a key part of the content"
#
angelo
i guess my point is that anything being marked up with eg. u-photo won't fall under "purely decorative"
#
angelo
and that if the image is described elsewhere then the alt tag *should* be omitted entirely
#
[tantek]
that's interesting as I believe that contradicts WCAG 2(.0,.1,.2)
#
angelo
the logic in the HTML spec makes sense. can you link to the section in the WCAG?
#
[tantek]
yes, thanks for the find [schmarty].
#
[tantek]
best I could find on short notice is https://www.w3.org/WAI/WCAG21/Techniques/html/H37.html which seems incomplete
#
sknebel
and I'd say that could apply for a bunch of images you'd also mark u-featured
#
[tantek]
so I'm probably missing where in the WCAG techniques it talks about when to use alt="some text, alt="", and not to ever leave the alt attribute unspecified (because absence indicates an error, not a particular semantic)
#
[tantek]
sknebel yes
#
sknebel
(+ of course the parse rules should also be ready for random new use cases for microformats)
gRegor joined the channel
#
gRegor
Yeah I think the mf2 property on an element is a stronger indicator of publisher's intent than whether they used alt="" to mean "purely decorative"
#
gRegor
I thought Monocle might rebuild with the alt attribute but it doesn't appear to based on the preview tool. It probably pre-dates the alt-text parsing change though.
btrem and gRegorLove_ joined the channel
#
btrem
The MDN page does not agree with the HTML 5 spec re: image alt attribute. The MDN page https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Omitting%20this%20attribute says "The alt attribute holds a text description of the image...."
#
btrem
The HTML spec https://html.spec.whatwg.org/multipage/images.html#alt says, "the value must be an appropriate replacement for the image."
#
btrem
Those are different. In fact, various HTML specs over the years have explicitly said that the alt text is *not* to provide a description.
#
btrem
And there are several examples where the advice is to include an empty alt attribute.
#
btrem
Here's an explicit proscription from the WHATWG spec: "It is important to realize that the alternative text is a replacement for the image, not a description of the image." So I think the MDN page is simply wrong, and I might just file an issue to have it changed.
#
btrem
Finally, as pertains to mf, I almost always use alt="" for images on my site because there is no useful alt text to replace the image. Usually because what might be good alt text is already on the page in prose. But I do use u-featured for a featured image.
[catgirlinspace] joined the channel