← All proposals

Logs table with divider

A recipe: the PDS Logs Table pattern (Table with hasPanel, status-colored rows and the inline detail panel) with a LabeledDivider as a row.

Extends a PDS componentOpen in Storybook

proposals/LogsTableWithDivider/LogsTableWithDivider.mdx38 lines · View on GitHub
import { Canvas, Meta, Title } from '@storybook/addon-docs/blocks';

import * as LogsTableStories from './LogsTableWithDivider.stories';

<Meta of={LogsTableStories} name='Usage' />

<Title />

## Purpose

Marks a point in time in a log, and lets the reader jump to another one, with a Labeled Divider inside the PDS Logs Table.

## Usage

This is a recipe, not a component. It is the PDS Logs Table pattern with one extra row.

- The divider is a table row. Its first cell holds a Labeled Divider (`size='xs'`) with a time selector and the date picker in its `action` slot; the other cells are empty.
- Entries are newest first, so entries above the divider are newer.
- Table has no row that spans columns, so the divider is stretched across the full row, edge to edge, with CSS. The row can't be clicked with a mouse, but it can still take keyboard focus and Enter opens an empty detail panel. The divider stops its own clicks and keys from reaching the row. A first-class separator row in Table would fix this (see the open question).
- Do not use it where keyboard users depend on the table until Table has a separator row. It works as a design example today.
- Mobile cards (`hasMobileCards`) are off in the example and are not handled.

## Accessibility

- The table keeps its label and the Prev and Next buttons in the detail panel keep theirs. The divider's time menu and date picker have their own labels, set by the screen.
- Keyboard: Tab reaches the divider's menu button. The divider row itself is also a tab stop, because Table makes every row focusable when the detail panel is on. Enter or Space on it opens an empty detail panel, and Prev and Next can step onto it. This is the known gap above.
- What is announced: the row's cells are empty except the first, which holds the divider. How a screen reader reads that row: not checked.
- Translate the divider label, the menu items and the date picker strings in the screen.
- The a11y panel, color contrast and light and dark: not checked.

## Implementation

The example is the Logs Table with one divider row. The divider row is an extra entry in the table data, with CSS to stretch the divider across it.

<hr />

<Canvas of={LogsTableStories.Default} />