hello friends of rblind. I am a sighted person who follows the kbin-core repo. I saw an issue #1143 opened recently regarding the use of alt in markdown. I am having a hard time discerning whether it is a productive request or not.

I understand that rblind is not a free-of-charge accessibility consultation company. But I thought I would point out this issue in case anyone had an interest in contributing to the discussion.

If I am posting in error, please either remove it or notify me so I can remove or edit the post.

Here is the text of the issue:

See this post

Current widespread wisdom is that you should specify alt text with the format ![alt text](url) but this ISN’T behaving as alt text. It’s behaving as a label. It needs to be set to the alt text attribute on the image.

True alt text doesn’t need to be rendered out. It’s a nice feature that apps like pixelfed give you a button to see the alt text, because it can give extra context, but this is a secondary feature. This would be great to add as well, but it’s out of scope here.

Labels are meant for things like crediting the photographer. See any well written news articles for examples of this. This one has an image of some sharks as a header. You’ll see underneath that it has an explanation and credits NIWA for the image.

There IS a way to specify labels in markdown, and leave the alt text in tact. The correct format is ![alt text](link "label goes here") but this isn’t currently recognised by kbin and the label gets completely stripped out. (link)

You can verify this by using something like this plugin.

Notice how all the post images are marked as “Missing alt attribute”

Notice how things like the magazine icon don’t render out their alt text “ArtemisAppPlayground Icon”

Further, see codberg’s handling of images:

alt text

![alt text](https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/SMPTE_Color_Bars.svg/320px-SMPTE_Color_Bars.svg.png "Label text here")

results in the following html:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/SMPTE_Color_Bars.svg/320px-SMPTE_Color_Bars.svg.png" alt="alt text" title="Label text here">

(codeberg displays labels as tooltips)

I honestly think it’s fine to keep using the first [part] as labels, mostly because this syntax is already widely in use, but I think the second (link "this bit") should be set to the image’s alt text attribute.

  • MostlyBlindGamer@rblind.comM
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    1 year ago

    I can only do math while on the clock and I’ve realized that also stands for complicated bug reports/feature requests/whatever this is exactly. Meaning I’m likely to miss something, but I’ll take a haphazard crack at it.

    Anyway, my understanding of Markdown is that the content between square brackets is the alternative text and that captions aren’t explicitly universally supported. See Markdown Guide.

    Lemmy-UI renders alt text from the content between square brackets, which is just perfect. Reddit, for what it’s worth, renders that - where it is supported - into alt text and a caption. That does lead to terrible alt text, where people (Reddit admins, specifically) only see the caption and forget where else that text is going. So yeah, having a separate caption sounds like a great idea.

    That being said, you (or OOP?) may enjoy getting into the weeds of accessible name calculation. Will a screen reader read alt or title? Both? In which order? (VoiceOver on macOS read alt and then title. Who knew!?)

    Now, I can’t imagine interface icons missing alt text will have anything at all to do with Markdown rendering. In fact, it’s possible they don’t need alt text at all, if the functionality is already accessible some other way, like through an adjacent text link. You can’t just leave out the alt attribute, you should hide the node, but I haven’t looked into kbin’s interface to find out if that’s the case. In fact, I haven’t looked into how kbin renders Markdown for images.

    So… does any of that help? Does it help formulate specific questions, perhaps? Who should I address the bill to? Hehe.

    • Kraiden@kbin.social
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Lol, honestly I’m already deeper down this rabbit hole than I ever thought I’d be.

      So far as I can tell, Kbin doesn’t provide a way to specify alt text on embedded images at all. You can attach an image to the post using the GUI, and specify alt text that way, but it will always be at the end of the post, and you can only have 1. Not ideal.

      Re: Syntax support. There’s no official spec for markdown, but there is a canonical syntax guide which describes the format I’m suggesting. You’re correct that it’s not very widely supported in implementation though.

      I think I created confusion on that ticket by talking about the codeberg.org implementation, which does support the suggested syntax, by populating the title attribute. I wasn’t necessarily suggesting it as a solution, and it sounds like that’s not a great implementation anyway.

      I created even more confusion by talking about a plugin that sighted devs or testers could use to see alt text, and gave a few examples of elements to look at. None of that is really relevant.

      I did try to clarify as a comment on the parent post here if you’re interested.

      • MostlyBlindGamer@rblind.comM
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        Right, text between brackets should really go into the ‘alt’ attribute. If we boil this down to that, it’s a good clear place to start.

  • Kraiden@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Hi, I’ve tried to clarify on the ticket, but I’ll post it here as well. Please note this is specifically for Kbin, not Lemmy.

    what they are trying to post

    This is applicable to anywhere markdown text is supported. Mostly thread text, and comments.

    is a URL to an image or an uploaded image

    I’ve only tried externally hosted images (URL)

    markdown by hand

    Yes, this is specifically about supporting hand written markdown. There are two variants:

    A) ![alt text here](url)
    B) ![alt text here](url "label")

    This ticket is both a bug report:
    neither variant actually populates the alt text html attribute

    And a feature request:
    Support variant B) above in some way to allow more meaningful alt text

    Example rendered currently:
    A) ![alt text here](url)

    <span>
      <i></i>
      alt text here
    </span>
    <div>
      <div>
        
      </div>
    </div>
    
    

    This format should at least populate the alt attribute

    B) ![alt text here](url "label")

    Currently renders exactly the same as A) with the "label" being completely stripped out.

    There are two possibilities for this format:

    Either 1)

    ...
      label
    ...
      
    
    

    Or 2)

    ...
      alt text here
    ...
      
    
    
    1. is more technically correct, but 2) is closer to existing functionality