Skip to content

Clarify when a screen reader should read the contents of preformatted text blocks

Screen readers reading HTML generally have three different behaviors for images with alt text:

  • no alt attribute at all: browser reads the URL out loud (generally, not very useful)
  • alt="": browser says nothing (useful for purely decorative images)
  • alt="a stop sign": browser reads out the content of the alt attribute's value

At first blush, it seems like Gemini clients should copy the latter two behaviors, but preformatted text can, at least occasionally, be usefully read out loud. (I'd wager that the vast majority of preformatted text in Gemspace can't be usefully read out loud because it's ASCII art, as opposed to code in a programming language or poetry.)

As an author, I'd like to have predictable behaviors (to the extent client authors are willing and able to support them) for people who use screen readers.

I suspect that if we keep the current structure of preformatted-text blocks, we should only support "skip silently" (when there's nothing there) and "read the alt text out loud" (when there is alt text).

While we could have trailing whitespace on the leading ``` toggle "read the contents of this preformatted-text block out loud" behavior, trailing whitespace (for quite literally invisible output, no less) seems too subtle by half. (IIRC Markdown's double-trailing-space for <br> gives some people fits, and that leads to easily-visible changes in the output.)

Thoughts?