Search topics
Animated headings split into single letters
A hero heading animated letter by letter is built from one inline-block element per letter, so Chrome gives screen readers the letters, not the words.
<span class="char">P</span> The problem
Screen reader users get an animated heading as a run of single letters, with nothing to show where one word ends, so the page's main message is spelled out to them
A planning app's home page opens on a deep blue hero with one large heading: Plan your week in minutes. As the page loads, the letters rise into place one after another, a few hundredths of a second apart. To animate each letter on its own, a script splits the heading before the animation runs: every word becomes an element, and every letter inside it becomes an element of its own, with display: inline-block so that it can be moved and faded. Splitting.js writes this markup, and its recommended stylesheet sets display: inline-block on each word and letter. GSAP's SplitText makes letters inline-block in the same way.
Sighted visitors see a sentence. What the browser passes on is something else. In Chrome's accessibility tree, the heading is named "P l a n y o u r w e e k i n m i n u t e s": a space between every letter, and nothing to show where one word ends and the next begins. We checked this in Chrome's own tree, not only in a library's notes, with letters in inline-block spans, inline-block divs inside word boxes, and plain spans in a flex row: all three gave the same run of letters. A screen reader reads what the tree gives it. Depending on the screen reader and its settings, a person hears the letters one at a time, or a string of sounds the speech engine guesses at, and the headings list shows the heading as letters too.
WCAG 1.3.2 asks that when the order of content affects its meaning, a correct reading sequence can be determined from the code. The letters of a word are the smallest such sequence, and here the code no longer holds the word: it holds a row of separate letters. W3C's failure F32 describes the same result reached another way, with spaces typed between the letters of a word to space them out. There, the spaces are in the text. Here, the text has none, but each letter is a box of its own, and the browser passes on each box's text apart.
Layout decides it. A letter in a plain inline span stays part of the word around it, and Chrome names a heading of inline letters "Plan your week in minutes". Once each letter is laid out as a box, with display: inline-block, or as the item of a flex or grid row, Chrome treats each as its own piece of text, and the space between the words is lost as well.
The heading is usually the first thing on the page and the one line that says what the site is for, so it is the line a screen reader user most needs to hear as words. A split link or button has the same problem, and is worse: its name in the links list, and the name voice control users say to press it, is the row of letters.
3 of 10 groups affected
- No vision (affected)
- Low vision (affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (not affected)
- Reach, strength (not affected)
- Cognitive (affected)
- Seizures (not affected)
- Without vision Each letter reaches the screen reader as a piece of text of its own, with no break where a word ends, so the heading can be read or spelled letter by letter, and its entry in the headings list is a row of letters. A braille display gets the same row of letters.
- Limited language, cognitive and learning abilities Read-aloud tools that take the page's text from the browser's accessibility tree get the same letters, so the words they speak don't match the heading on screen.
- Limited vision Screen magnifier users who turn on speech are given the same letters as screen reader users.
To a scan, the heading is fine: it is a heading, it has text, and every letter is real text with enough contrast to measure. No axe rule looks at how a word is laid out. axe meets the letters in one case only: it won't fail the contrast of text a single character long, since it can't tell whether one character is actual text, so a letter whose contrast falls short is listed as a check it couldn't decide, not as a failure. A letter with enough contrast simply passes. An AI assistant reading the template sees Plan your week in minutes in the source; the split is made by a script at run time. EaseWeb's audit reads the page as rendered and reports three or more single-letter boxes in a row in a heading, link or block of text as ew:split-letter-text, quoting the letters as Chrome gives them. Where axe leaves letters undecided, its contrast check measures them as the word they make, from a screenshot of what is behind them.
Try it
Compare the heading on screen with what a screen reader is given for it
Turn on “Show the boxes” to outline each box the animation moves. Under the page is the heading as Chrome passes it on, and as the headings list shows it. Then apply each fix: does the heading still rise, and does a screen reader get words?
Broken Can you fix this?
Plan your week in minutes
One calendar for work, school runs and everything between.
Screen reader says:
heading, P l a n y o u r w e e k i n m i n u t e s
Its list of headings:
- P l a n y o u r w e e k i n m i n u t e s
The fix
Give screen readers words, and animate what they skip
<section class="hero"> <h1 class="hero-title"> <span class="word"> <span class="char" style="--char-index: 0">P</span> <span class="char" style="--char-index: 1">l</span> <span class="char" style="--char-index: 2">a</span> <span class="char" style="--char-index: 3">n</span> </span> <span class="word"> <span class="char" style="--char-index: 4">y</span> … </span> … </h1></section>What is wrong3 points
- Each letter is an inline-block element of its own.
- So Chrome names the heading "P l a n y o u r w e e k i n m i n u t e s", with no break between the words.
- The headings list, and anything else that reads the heading's text, gets the same run of letters.
Words for screen readers, letters hidden
<section class="hero"> <h1 class="hero-title"> <span class="visually-hidden">Plan your week in minutes</span> <span class="letters" aria-hidden="true"> <span class="word"> <span class="char" style="--char-index: 0">P</span> <span class="char" style="--char-index: 1">l</span> <span class="char" style="--char-index: 2">a</span> <span class="char" style="--char-index: 3">n</span> </span> <span class="word"> <span class="char" style="--char-index: 4">y</span> … </span> … </span> </h1></section>How it is fixed2 steps
- Put the words in the heading once, as text that is hidden on screen but kept for screen readers. The heading is now named "Plan your week in minutes".
- Wrap the letters in an element with
aria-hidden="true", and split only that element. Screen readers skip the letters, so the words are read once.
This fixes the Before and passes 1.3.2, on any element: a heading, a link, a paragraph. The animation is unchanged. The words are written twice, so keep the hidden copy and the letters built from the same string.
All three pass on a heading. Animating whole words is the plainest: there is nothing hidden, nothing written twice and no ARIA, and it keeps working whatever element the text is in; choose it when the design can live with words rising instead of letters. When the letters must move one by one, use the hidden words with the letters under aria-hidden: it works on any element, including a paragraph or a block of text in a div. The name on the heading is the smallest change if you already use GSAP's SplitText, which writes it for you, but it holds only on a heading, a link or a button.
Hiding the letters is half of each fix. A name or hidden copy on its own, with the letters still exposed, leaves a screen reader two things to read: Chrome names the heading with the words, but reading down the page, the letters are still there, one at a time. Hide the letters with aria-hidden="true" on a wrapper or on each word box, never on the heading itself, which would hide the hidden copy too.
Check what your library writes. Splitting.js adds no ARIA. GSAP's SplitText, since 3.13, adds by default (its aria option set to "auto") an aria-label to the element it splits and aria-hidden="true" to every line, word and letter; on a heading that is the third fix above, and on a p or div it is the failure described there. GSAP's documentation says its automatic labels don't carry links or other elements inside the text, and points to a hidden copy for those. Text with a link inside it is better split into words, or left whole.
The letters' animation itself is another topic: letters that rise or fade in as the page loads or scrolls should stay still when the system asks for reduced motion, as the prefers-reduced-motion query does in each snippet above.
Verify the fix
3 checks, no mouse.
Test with: Screen reader
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the animation or its library changes.
Limits
This is a starting pattern, not a guarantee for every application. It covers a heading split by a script into letters for an animation, and was checked in Chrome's accessibility tree; other browsers build their trees in their own way, and no screen reader was tested for this guide. Whether a screen reader spells the letters, reads them as sounds, or joins some of them depends on the screen reader, its settings and its speech engine. Text split into lines, for a line-by-line reveal, keeps its words and is not covered here.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
References
- WCAG Understanding: meaningful-sequence (opens in a new tab)
- WCAG Technique F32 (opens in a new tab)
- w3.org: wai-aria-1.2 (opens in a new tab)
- developer.mozilla.org: aria-hidden (opens in a new tab)
- splitting.js.org: guide (opens in a new tab)
- gsap.com: SplitText (opens in a new tab)
- gsap.com: a11y (opens in a new tab)
- css-irl.info: how-to-accessibly-split-text (opens in a new tab)
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.