Skip to main content
WCAGrules
Quick navigation

Announce chat and feed updates with role=log

role=log is for a container that gains entries in order over time. A chat transcript, an activity feed, a build log. W3C lists it as sufficient for 4.1.3 Status Messages. The role carries two defaults that do the work, and knowing them saves a lot of tinkering. It is polite, so announcements wait for a gap rather than cutting across whatever is being read. It is non-atomic, so only the appended entry is announced rather than the whole transcript being read again from the top. That second default is the difference between a usable chat window and one that becomes unbearable at message 30. Put the role on the container that stays put, not on the messages you append.

How we find it in an audit

The role is an automated find. Everything that matters after that is a listening test, so we sit with the feature running and check three things. That new entries are announced, that only the new entry is announced, and that a burst of updates does not bury whatever the person was actually reading.

How affected users experience it

In a chat with no live region, replies arrive in silence. The only way to find out whether somebody answered is to move back into the transcript and read the end of it, over and over, which means nobody can hold a conversation and do anything else. With role=log, each new message is spoken as it lands, once, and the last thing the person was reading is not interrupted.

Passes vs. fails

Passes: the action announces itself. Fails: screen readers hear nothing.

Passes

<div class="chat-history" role="log"></div>
<!-- appended messages are announced as they arrive, one at a time -->

Fails

<div class="chat-history"></div>
<!-- script appends each new message div, silently -->

Other ways to satisfy this rule

15 guides on this site are filed under 4.1.3 Status Messages. W3C lists this one as sufficient for that rule on its own. Implement it correctly, in a way your readers' software actually supports, and the rule is met.

This guide is our interpretation of W3C technique ARIA23: Using role=log to identify sequential information updates. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.

Go somewhere useful

Find tools, resources and your workspace.

29 destinations