How to build an accessible MessageActions in React

A named group of real buttons. Good and Bad are toggle buttons (aria-pressed), so the chosen rating is exposed as state rather than by a changing label, and choosing one announces "Thanks for your feedback" once through the shared announce() region. Icon buttons carry accessible names and meet the coarse-pointer target size

When to use a MessageActions

When not to use it

Keyboard interactions

Role group, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Swapping the rating button’s label to "Good response recorded"

Prefer: Keep a stable name and expose the choice with aria-pressed; the component announces the confirmation once

A name that changes on press reads as a different control; aria-pressed is how toggle buttons report state

Example

<MessageActions copyValue="Refunds are available for 30 days." onFeedbackChange={() => {}} onRegenerate={() => {}} />

See the full MessageActions reference →