[spec] Clarify purpose of alt-text

Adnan Maolood me at adnano.co
Sun Feb 28 15:06:48 GMT 2021


Recently there was some discussion regarding the accessiblity of
preformatted text lines. This proposal aims to address those concerns by
simply clarifying the purpose of alt text.

During the discussion John Cowan said:

> I think that most preformatted blocks are meant to be readable.  How about
> an option to hide preformatted blocks if and only if they have alt text?
> That, plus social pressure to actually *provide* alt text, even if it's
> just "ascii art" or "ascii art kittens", should do it.

https://lists.orbitalfox.eu/archives/gemini/2021/005633.html

I agree with John. I believe that a clarification to the specification
is the best way to resolve this issue.

Alt text should serve one and only one purpose: provide an alternative
text representation of preformatted text. If a block of preformatted
text does not need an alternative text representation (i.e., it can be
read aloud as is), then it should not have any alt text.

Section 5.4.3 of the Gemini specification currently states:

> Any text following the leading "```" of a preformat toggle line which toggles
> preformatted mode on MAY be interpreted by the client as "alt text" pertaining
> to the preformatted text lines which follow the toggle line. Use of alt text
> is at the client's discretion, and simple clients may ignore it. Alt text is
> recommended for ASCII art or similar non-textual content which, for example,
> cannot be meaningfully understood when rendered through a screen reader or
> usefully indexed by a search engine. Alt text may also be used for computer
> source code to identify the programming language which advanced clients may
> use for syntax highlighting.

I propose that the final sentence be removed, and that MAY be replaced
with MUST:

> Any text following the leading "```" of a preformat toggle line which toggles
> preformatted mode on MUST be interpreted by the client as "alt text" pertaining
> to the preformatted text lines which follow the toggle line. Use of alt text
> is at the client's discretion, and simple clients may ignore it. Alt text is
> recommended for ASCII art or similar non-textual content which, for example,
> cannot be meaningfully understood when rendered through a screen reader or
> usefully indexed by a search engine.

This would mean that should a screen reader encounter a preformatted text
block with a non-empty alt text, the alt text would be read aloud and the
preformatted block would be skipped. After all, that's what "alternative
text" is supposed to mean.


More information about the Gemini mailing list