Course contentsShow
← Web Development
Lesson 1117 of 2,98220. Screen Readers and Assistive TechnologyFree lesson

Log Role for Sequential Updates

Using role='log' for chat messages, activity feeds, and other sequential content streams.

Log Role for Sequential Updates

What you'll learn: How to use role="log" to announce sequential content that arrives in chronological order, like chat messages or activity feeds.

What Is the Log Role?

The role="log" attribute marks a container as a live region where new information is added sequentially—think of it like a scrolling log file. When you add content to a log region, screen readers announce it automatically, but non-urgently (unlike an alert). This is perfect for chat applications, activity feeds, game logs, or any stream of updates where order matters.

How Log Differs from Other Live Regions

You've learned about status (polite, passive updates) and alert (urgent interruptions). Log sits in between: it's polite like status, but specifically designed for sequential streams where each new item is meaningful on its own and should be read individually.

Think of it like a news ticker: each headline is announced as it appears, but the screen reader doesn't interrupt what you're currently doing.

Basic Usage

<div role="log" aria-live="polite" aria-atomic="false">
  <p>User Sarah joined the chat</p>
  <p>User Mike: Hello everyone!</p>
  <!-- New messages appended here -->
</div>

Notice aria-atomic="false" is implicit with role="log"—screen readers announce only the new additions, not the entire log each time.

When to Use Log Role

  • Chat applications: New messages arrive one at a time
  • Activity feeds: Social updates, notifications
  • Game logs: Turn-by-turn actions
  • Error/debug consoles: Sequential system messages

Key Takeaway: Use role="log" for sequential, chronological content streams where each new item should be announced individually without urgency—perfect for chat messages and activity feeds.