Loading...

Using white space characters to control spacing within a word

1.3.2 Meaningful Sequence

Introduction

This document provides information about the related Acquia Optimize checks:

  • Using white space characters to control spacing within a word.

What

White space characters such as spaces, tabs, line breaks, or carriage returns must not be used to visually format individual words. 

Why

When you use white space characters like spaces, tabs, line breaks, or carriage returns to visually format individual words, it can harm accessibility. This practice can create challenges for users who rely on screen readers or other assistive technologies, as these tools interpret white space differently than visual users. Instead of seeing a well-formatted word, users may hear unnatural pauses or broken speech, which makes the content hard to understand. Additionally, this method can cause layout issues on different devices.

Affected users

This check affects the following users who have:

  • Visual impairments: Who access the site contents with a screen reader or screen magnification software.

    User story

    Bridgit is a blind mother to a five-year-old girl and an 11-year-old boy:

    "Sometimes it feels like my screen reader gets the hiccups. It is kinda funny, but you know, when they format headings or other text with spaces between the letters to make it look nice for people who can see, it messes things up for me. Instead of reading the words, it is like my screen reader just starts hiccuping out the letters one by one, really fast. I have to concentrate so hard, and it is like I am listening to someone with the worst case of the hiccups!”

Examples

This section gives some examples of the issue.

Example: Heading formatted with the space character

In the example, a song title is formatted with spaces between each letter. This means that screen readers, which are often used by people who are blind, will not read the title as words but as a sequence of letters in quick succession. This makes it difficult to understand the meaning.

<h1>B a c k  I n  B l a c k</h1>
<p>Back in black, I hit the sack</p>
<p>I've been too long, I'm glad to be back</p>
<p>Yes, I'm let loose from the noose</p>

Example: Heading formatted with CSS

In the example, a visual effect of spacing between the letters is achieved once again. However, because this effect is created with CSS letter-spacing, it does not interfere with the correct reading by screen readers.

<h1 style="letter-spacing: 1em;">Back in Black</h1>
<p>Back in black, I hit the sack</p>
<p>I've been too long, I'm glad to be back</p>
<p>Yes, I'm let loose from the noose</p>

How

How to fix it

The Acquia Optimize platform highlights elements that contain text nodes that are formatted with whitespace characters. To resolve this issue, you should adjust your content to avoid whitespace characters for visual formatting. Instead, you can use CSS as illustrated in the “Examples” section above.

Additional resources

WCAG success criteria

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation