Skip to content

Comment row

Pro

One comment or message in a thread: avatar, bubble, what goes under it and a 48dp actions row that spaces the comments. Not an M3 component (@windmorph/react-pro).

import { CommentRow } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Keyboard

Comment row keyboard
KeyAction
TabMoves focus to a pressable bubble, then to the actions in the actions row. A static bubble is skipped.
Enter or SpacePresses a bubble with onPress.With onPress
EnterFollows a bubble with href.With href

The actions in the actions row are your own components and keep their own keys.

Screen reader

Role
The root is a div, an article or an li (as). A pressable bubble is a button with onPress, or a link with href; otherwise it is plain content.
Accessible name
An article takes its name from aria-label ("Comment by Ada"). A pressable bubble is named by its content: the name line and the words.
States announced
Busy (aria-busy) while pending.

The avatar is read as whatever you pass. Pass it decorative, since the name is in the bubble.

Focus

A pressable bubble is in the Tab order and shows M3's focus indicator on keyboard focus: a 3px secondary outline 2px outside the bubble. Pointer presses show no ring.

Touch target

  • A pressable bubble is as large as its content plus 8px above and below and 12px at the sides; it has no added touch target.
  • The actions row is at least 48px tall (actions-height), room for actions with 48px targets.

Motion

The filled bubble fades between its pending colour (surface-container) and its sent colour on the effects spring; a colour fade isn't movement, so it still fades under reduced motion. A pressable bubble's hover and focus state layers fade too, and under reduced motion its press ripple appears at full size without growing.

What you need to do

  • With as="article", give each row an aria-label such as "Comment by Alex". Use as="li" inside a list.
  • Pass the avatar decorative (no name of its own), since the name is in the bubble.
  • Don't put buttons or links inside a pressable bubble: put actions in actions.
  • Give every action in the row a visible label or an accessible name, and a touch target of 48px.
  • In forced-colours mode the bubble keeps a border; keep classNames overrides from removing it.