How would you markup a poem or song to be accessible to the visually impaired?
My initial markup was
<ol class="stanzas">
<li><ol class="stanza">
<li>Roses are red</li>
<li>Violets are blue</li>
</ol></li>
</ol>
However, this sort of markup is annoying with screen readers like Android TalkBack.
It's annoying to hear "1/4 Roses are red." I'd rather hear just "Roses are red."
Markup like the following sounds a little nicer in a screenreader but because I use CSS to style the lines as separate blocks of text each line has to be manually swiped through.
<div class="stanzas">
<p class="stanza">
<span class="line">Roses are red</span>
<span class="line">Violets are blue</span>
</p>
</div>
Each line should be read as a sentence not as a paragraph.
There's still a problem of the reader not reading each line as an individual sentence.
<div class="stanzas">
<p class="stanza">
<span class="line">Roses are red.</span>
<span class="line">Violets are blue.</span>
</p>
</div>
Sounds right but now you've changed the textual content of the poem. You could go further and hide the full stops with CSS but this feels like stacking hacks on tops of hacks.
Is there a better way for marking up a poem or song for screenreaders so that stanzas are read as paragraphs and lines are read as sentences?
` instead of a full stop do the job? If I understand, you want separate lines anyway. – Ignatius Reilly Nov 15 '22 at 01:36