Skip to content

react: make the table header readable - field names, value name and the top-left corner #920

Done

Description

@eizedev

Readers often ask how to read the table's header: which names are fields, which are items, and what the numbers are. The fix belongs in the table itself, because it also stands without the zones above it (exports, embedded reports).

Reproduce

Playground: https://pivotkit.eize.dev/playground/?data=tickets&start=tickets-per-team-and-priority

  • As loaded: Team on Rows, Priority on Columns, Count of Ticket on Values.
  • Add Category to Rows and Channel to Columns for two levels on each axis.

What confuses readers

  • Column field names sit in the last row-header column. "Priority" and "Channel" stand in the same column as "Category", so they read as part of Category.
  • The value name takes its own header row. "Count of Ticket" is left-aligned over the first data column. It reads as the heading of that one column, and it costs a row.
  • Field names look like items. "Priority" and "P1 Critical" have the same weight, and every item carries a sort arrow, which makes the header busy.

What works: row field names ("Team", "Category") stand above their own columns.

Proposal: the corner as a legend

  • The value name goes into the top-left corner cell; its own row goes away. With two or more value fields, the values stay the lowest column level.
  • Each column field name spans the corner, right-aligned and pointing at its level ("Priority →", "Channel →"), one per column level.
  • Row field names stay above their columns.
  • Field names look different from items: smaller, muted, with the zone icons (≡ Rows, ||| Columns), so the reader links them to the zones.
  • Sort arrows on items show on hover, on focus and when that item is sorted.
  • Phone width: the row fields share one header column, so their names stack there ("Team › Category").

An empty corner (some grids only put a field chooser there) is not enough: it leaves the reader to guess which field is on which axis.

Open for whoever builds it: the exact styling, and whether the legend should be a table setting (Excel lets users hide field headers).

Check

  • Screenshots from the playground before and after: one and two levels on each axis, one and two value fields, light and dark, 1280 px and 390 px.
  • Screen readers: the corner cells keep header semantics, so a data cell still announces its row and column items.
  • Export (XLSX, CSV, HTML report) keeps a readable header.

Activity

  1. added
    accessibility
    enhancement
    area:react
    on Nov 25, 2026
  2. eizedev commented on Nov 25, 2026

    @eizedev
    OwnerAuthor

    Decision, after mockups and a UX review:

    Table header (B3)

    • Layout as today: field names in the header, the value row stays. No caption above the table, no direction arrows.
    • Each field name gets the icon of its zone (rows, columns, values) and a fill in the zone colour.
    • The sort arrow sits behind the name, only on the sorted field, in the text colour and bold. Other header cells show it on hover and keyboard focus.
    • With two or more values, the repeated value names get the icon, without fill.

    Field area and field list

    • Chips get a fill in their zone colour, no coloured border. Filter chips stay neutral.
    • Zone headers and the field list's zone badges use the zone colours.
    • Data-type icons (Aa, #, date, yes/no) are neutral grey by default.
    • One radius for chips, field names in the table and the field list's hover.
    • The fill is an opaque mix of the zone colour into one shared base, so it is the same colour in the field area and in the table. Default strength 16%.
    • Drag and drop keeps its own clear states (dragging, drop target). The fill must not hide them.

    Tokens (light / dark defaults, all overridable)

    • --pk-zone-rows #1d5fcc / #8db4ff, --pk-zone-columns #a85a00 / #f2b559, --pk-zone-values #0b7a5c / #5fd6ac, --pk-zone-filters = the muted text colour.
    • --pk-zone-tint (16%) and --pk-zone-tint-base (the shared base).
    • The radius comes from one existing radius token.
    • --pk-type-string, --pk-type-number, --pk-type-date and --pk-type-boolean default to the muted colour; set them to colour the types again.
    • .pk-chip-values takes its border from --pk-type-number today; it moves to the zone tokens.
    • A fallback for browsers without color-mix(), and a system border in forced-colors mode.

    Open points from the review

    • Sorting from the keyboard and on touch: a real button in the header cell with aria-sort. On touch the field menu stays the way to sort.
    • Screen readers: scope on the header cells, a label for the empty corner.
    • The focus ring must stay distinct from the blue rows fill.
    • Check at 390 px and in narrow embeds.
    • The zone colours measured at least 4.6:1 against the header in both themes. Measure again in the real component.

    Final review of the mockup: fix while building

    • Chip controls (×, ⌄) on the 16% fill: the faint icon colour measured 2.4–3.0:1. Use a control-icon colour that reaches 3:1 on every fill.
    • Target size: × and ⌄ need a 24×24 px hit area each (WCAG 2.5.8); the sort target in the header at least 24 px high.
    • Keyboard: a visible focus state on chips and header cells, distinct from the rows fill. Every drag action also works from the menu (move to Rows/Columns/Values/Filters, order), and sorting works from the keyboard (WCAG 2.5.7).
    • Zone colours are for icons only, never for text: in the light theme they measure 4.1–4.7:1 on the fill.
    • One sort glyph for the same state in the chip and in the table header, with a text such as "sorted by value, descending" for screen readers.
    • Radii as a rule: controls 7 px, containers 8 px, nested badges 5 px, from tokens. The type icon text at least 11 px.
    • Data-type colours stay overridable through --pk-type-* (no !important).
    • More tokens: control-icon colour, focus ring, sort arrow, field-list hover fill.
    • Reflow at 200% zoom and 390 px (WCAG 1.4.10): zones in one column, chips wrap, the field list as a drawer.
  3. added this to the 0.11.0 milestone on Nov 25, 2026
  4. eizedev commented on Nov 26, 2026

    @eizedev
    OwnerAuthor

    Done: the table header, zone colours and tokens came in #962, and the PowerShell Universal module maps the new tokens since eizedev/powershell-universal-components#242.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityarea:reactenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions