Skip to content
easeweb
Search topics

Chat widgets that never announce their messages

A support chat keeps its messages in a plain div, so a screen reader never reads the greeting when the panel opens, or a reply when it arrives.

WCAG 2.2
SC 4.1.3AA· new in 2.1
Required by
EN 301 549 (EU)
Broken messages.append(bubble)
The accessibility problem illustrated: No vision:Did anyone answer?
01

The problem

Screen reader users don't hear a support chat's greeting when they open it, or its replies when they arrive

02

Try it

Open the chat and send the message. What does a screen reader read?

  • Press Tab to reach Chat with us, then Enter. Focus goes to the message field: is the greeting read with it?

  • Press Enter to send the question, and watch the panel under the page for what a screen reader says when the reply arrives.

  • Close the chat with Escape or the ×, and open it again: what is read now?

Broken Can you fix this?

BrokenA chat that reads neither the greeting nor the replies

Delivery

Most orders arrive within five working days. Large items are delivered on a day you choose.

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Have the greeting and every reply read out

Before
BrokenA chat that reads neither the greeting nor the replies
<button type="button" class="chat-launcher">Chat with us</button><section id="chat" class="chat-panel" aria-labelledby="chat-title" hidden>  <div class="chat-header">    <h2 id="chat-title">Chat with Birchwood</h2>    <button type="button" class="chat-close" aria-label="Close chat">×</button>  </div>  <div class="chat-messages">    <p class="message from-us"><span class="visually-hidden">Birchwood: </span>Hi! How can we help with your order?</p>  </div>  <form class="chat-form">    <label for="chat-input" class="visually-hidden">Message</label>    <input id="chat-input" autocomplete="off">    <button>Send</button>  </form></section>
What is wrong2 points

The rest of the panel works: the launcher and the close control are named buttons, Escape closes the panel too, and focus moves into the panel and back out to the launcher. The messages are where it fails.

  • The greeting is never read when the panel opens. Focus moves to the field, which is read by its label, "Message", and nothing more.
  • A reply that arrives is never announced. The conversation is a plain div, so appending a reply changes the screen and nothing else.
After

A log for the messages, read when the panel opens

<button type="button" class="chat-launcher">Chat with us</button><section id="chat" class="chat-panel" aria-labelledby="chat-title" hidden>  <div class="chat-header">    <h2 id="chat-title">Chat with Birchwood</h2>    <button type="button" class="chat-close" aria-label="Close chat">×</button>  </div>  <div class="chat-messages" role="log" aria-label="Messages">    <p id="message-0" class="message from-us"><span class="visually-hidden">Birchwood: </span>Hi! How can we help with your order?</p>  </div>  <form class="chat-form">    <label for="chat-input" class="visually-hidden">Message</label>    <input id="chat-input" autocomplete="off">    <button>Send</button>  </form></section>
How it is fixed6 steps
  1. Give the conversation role="log". It becomes a live region, polite by default, so a screen reader finishes what it is saying and then reads each message added to the end, without moving focus.
  2. Keep the log in the page's HTML before any reply arrives. That is what lets the browser see each reply as a change.
  3. Name the log with aria-label="Messages", so a screen reader can say what it is.
  4. Give each message an id: message-0 for the greeting, and the next number for each one addMessage() adds.
  5. In openChat(), set the field's aria-describedby to the id of every message. The field is read with the conversation so far: "Message, edit text. Birchwood: Hi! How can we help with your order?" Opening it again later reads every message since the start. The ids point at the messages, not at the log, because a description taken from the log can come out as its name, "Messages", instead of what is in it.
  6. Remove the description when focus first leaves the field, so going to Send and back doesn't read the conversation again.

Each message carries its sender in visually hidden text, so the reply is read as "Birchwood: Yes. Until your order ships, you can change it under Your orders." This fixes the Before and passes 4.1.3.

Easily confused
04

Verify the fix

5 checks, no mouse.

Test with: Screen reader, Keyboard

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the chat widget, its vendor's script or its settings change.

Limits

This is a starting pattern for a chat panel that sits over the page, not a guarantee for every widget. Live regions behave differently across screen readers and browsers, especially for regions that are hidden and shown, or inside frames, so test with the ones your visitors use. When a field's description is read also depends on the screen reader and its settings: most read it after the field's name, some only after a pause or with hints turned on. Auditors differ on whether each chat reply is a status message: role="log" is meant for the progress of a process,* (source 1) and a chat is its example.* (source 2) A reply that is never announced still leaves screen reader users waiting, whichever criterion it is counted under. The message field has a problem of its own when Enter sends: an input method's Enter can send the message before the word is confirmed. Escape is used by an input method too, to cancel a conversion, so the Escape handlers above ignore a key pressed while a word is being converted. Whether the chat offers a person at all is a separate question, covered in help chatbots with no way to reach a person.

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