Notification list
The rows of a notification centre. ds::notification-list,
ds::notification-group and ds::notification-item. Host-driven: no
fetching, no sockets.
Anatomy
section[aria-labelledby] notification-list
├── div h2 title · badge(unread) · actions slot
├── ul.divide-y > li … items, ungrouped
│ or section[data-ds-notification-group] > h3 label + ul > li …
│ or ds::empty-state (bare, bell) empty slot
└── footer slot | a[footerHref]
li[data-ds-notification][data-unread?][x-data=dsEmit?] notification-item
├── avatar slot | span.rounded-full(tone) > icon
├── div
│ ├── a[data-ds-notification-link].after:absolute.after:inset-0 (or p) "Unread: " · title
│ │ · time[datetime][title] · dot (aria-hidden)
│ ├── div body (slot)
│ └── div.relative.z-10 actions slot
└── div.relative.z-10
├── button[data-ds-emit=read] unread only
└── button[data-ds-emit=dismiss] dismissible only
The stretched link: the title is the row's one link; its ::after covers the
row (li is relative), so a press anywhere follows it. Actions and the
row's buttons are relative z-10, above that layer and outside the link.
The link draws no ring of its own (outline-hidden); the row draws it with
has-[[data-ds-notification-link]:focus-visible]:.
Times go through Support\Moment (relative, full date as title), as
timeline-item's do.
Events
read and dismiss, bubbling, from the button, with { id }, through
dsEmit (one listener on the row). The list draws nothing on them.
Accessibility
| Role | section named by its h2; group h3s; lists of li |
| Name | the link by its title, "Unread: " first when unread; the buttons "Mark as read: {title}", "Dismiss: {title}" |
| Keyboard | Tab: the row's link, its actions, Mark as read, Dismiss |
| Focus | the row draws the link's ring inside its edge |
Do not
- Do not nest buttons in the link. Stretch it instead.
- Do not put a live region on rows.
- Do not use colour alone for unread: the dot has the words.
From the package repo: edit this page on GitHub.