Skip to content
easeweb
Search topics

Rich text editors announced without their label

The typing area is a contenteditable div that a label element can't name, so it has no name, or the generic one its editor library gives every editor.

WCAG 2.2
SC 4.1.2ASC 1.3.1ASC 2.5.3A· new in 2.1
Required by
Section 508 · EN 301 549 (EU)
Broken aria-label="Rich Text Editor. Editing area: main"
The accessibility problem illustrated: No vision:Is this the message box?
01

The problem

Screen reader users aren't told which box they are writing in, and voice control users can't reach it by saying the label everyone else sees.

02

Try it

Tab into the message box and see what it is called, then say “Click Message” with voice control.

  • Broken 1: the label above the box is a label element, but its for can’t reach a div, so the box has no name, and nothing gives it a role.

  • Broken 2: the editor library names the box itself, with words that appear nowhere on screen.

  • Apply a fix. Then turn on Reword the label and try both fixes again: which name follows the new words?

Broken Can you fix this?

The parcel arrived with a cracked lid.

(Tab into the message box)

Voice control (simulated):

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Make the box a text box named by the label beside it, with aria-labelledby or the library's label setting.

  1. 1The editable element has role="textbox" and aria-multiline="true".
  2. 2Its name holds the words of the label shown beside it, best by pointing aria-labelledby at that label.
  3. 3Never leave the name the editor library gives every editor.
Before

An editable div with no role

<label for="message">Message</label><div class="toolbar" role="toolbar" aria-label="Formatting">  …</div><div id="message" class="editor" contenteditable="true">  <p>The parcel arrived with a cracked lid.</p></div>
After

A text box that points at its label

<div id="message-label">Message</div><div class="toolbar" role="toolbar" aria-label="Formatting">  …</div><div id="message" class="editor" contenteditable="true" role="textbox" aria-multiline="true" aria-labelledby="message-label">  <p>The parcel arrived with a cracked lid.</p></div>

Easily confused
04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Screen reader, Speech input

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the editor library is upgraded.

Limits

This is a starting pattern, not a guarantee for every editor. It covers the typing area's role and name, not the rest of the editor. An editor that keeps the Tab key to indent, so that keyboard users can't leave it, is covered in keyboard traps in editors and embedded widgets. A Bold button that doesn't say whether it is on is covered in toggle buttons that don't say whether they are pressed, and toolbar icons with no name in icon-only buttons with no accessible name. A toolbar that takes one Tab stop and moves with the arrow keys belongs to the topic "Toolbars work with arrow keys and take one Tab stop", which has no guide yet. Asking for alt text when people add an image to the editor is covered in image uploads that never ask for alt text. Labels on native fields are covered in form fields with missing or mismatched labels. Test the complete journey with your target assistive technology.

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.

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.

See the service