Skip to content

v0.5.0

Choose a tag to compare

@anthony-liddle anthony-liddle released this 24 Oct 16:49
7932b5c

0.5.0 is the last round of breaking changes before the API settles. Every change, with what to do, is in MIGRATION.md.

New

  • Multi-column sort, opt-in with useTableSort({ multiSort: true }). Shift+click a header to add it as the next sort key, or press Shift+Enter or Shift+Space on a focused header. While two or more columns are sorted, each header shows its place, and screen readers hear it ("sort priority 2, descending").
  • Row expansion with a real button. renderExpandedRow adds a leading expand column with a disclosure button per row. It works by keyboard and screen reader, with aria-expanded and aria-controls. The table keeps the open rows itself, or you hold them with useTableExpansion. expandOnRowClick toggles a row from a click anywhere on it.
  • One persistence scheme. Give the table and its hooks the same persistKey.
    • URL params are namespaced (members.sort=name,-team&members.page=3), so two persisted tables can share a page, and a copied link reproduces the view it came from.
    • Storage keys are versioned (rdt:1:members:sort).
    • Restoring never causes a hydration mismatch, and every hook returns isRestored.
  • Pagination without a total, for cursor APIs. Leave totalCount out, and the footer shows the page's range while Next follows hasNextPage.
  • Every accessible name is translatable. labels now covers every string the table announces, and each row menu is named after its row.

Breaking

  • TableColumn.id is required, and getColumnId is gone.
  • sort is { sortBy, onSort }, and useTableSort returns it as it is.
  • useTableSelection returns the selection prop as it is.
  • usePagination, useCursorPagination and usePersistedFilters take or return options objects.
  • renderExpandedRow returns content only.
  • Persistence keys and URL params changed, and 0.4 saved state is ignored.
  • Several renames and removals:
    • callbackAction is now onSelect.
    • The column className is now headerClassName, and its rowClassName is now cellClassName.
    • PaginationClient is now Pagination.
    • page and of are now pageOf.
    • --drag-selection is now --rdt-drag-selection.
    • SortOrder and uppercase sort directions are gone.

See MIGRATION.md for the full list.

Fixed

  • Choosing a plain action-menu item with Enter or Space closed the menu without running it.
  • Clicks on a row's controls (its checkbox, links, buttons) also fired onRowClick.
  • Without an action menu, each row's last cell spanned two columns. With an action menu, the empty and expanded rows counted one column too many.
  • Checkbox ids repeated across tables, and a page element with the same id as a column could take over that column's label in the panel.