Skip to content

feat: add progressive disclosure to data tables for mobile usability#392

Open
Ejirowebfi wants to merge 1 commit into
Invoice-Liquidity-Network:mainfrom
Ejirowebfi:feat/progressive-disclosure-tables
Open

feat: add progressive disclosure to data tables for mobile usability#392
Ejirowebfi wants to merge 1 commit into
Invoice-Liquidity-Network:mainfrom
Ejirowebfi:feat/progressive-disclosure-tables

Conversation

@Ejirowebfi

Copy link
Copy Markdown

Body:

Summary

Closes #216

Complex data tables (invoice list, LP positions, earnings history) rendered all
columns on mobile, forcing horizontal scroll and hurting usability. This PR adds
progressive disclosure: on mobile each row collapses to a few key columns and
expands on tap/keyboard to reveal all fields inline. Desktop keeps the full table.

Changes

  • useMediaQuery hook (src/hooks/useMediaQuery.ts) — SSR-safe matchMedia
    subscription with addEventListener/addListener fallback. Exports a shared
    MOBILE_QUERY = "(max-width: 639px)" constant (< 640px per spec).
  • ProgressiveDisclosureCards (src/components/ProgressiveDisclosureCards.tsx) —
    reusable, column-config–driven wrapper that renders collapsible cards.
  • InvoiceTable — added an isKeyColumn flag to ColumnDefinition and a mobile
    branch that renders the cards. This covers invoice list + LP positions, since
    both render through InvoiceTable (LP positions via LPPortfolio). Desktop table
    unchanged.
  • LPPortfolio — flagged ID, Status, and Amount Funded as key columns.
  • LPEarningsHistory — added a mobile branch (key columns: Invoice ID, Amount
    Funded, Earned; all 9 fields revealed on expand).

Accessibility

  • Row toggle is a native <button> → keyboard-triggerable (Enter/Space) and focusable
  • aria-expanded reflects open/closed state; aria-controls links to the detail region
  • Detail panel toggled via hidden; the chevron icon is aria-hidden

Behaviour

Viewport Render
Desktop (≥ 640px) Full table (unchanged)
Mobile (< 640px) Key columns only; tap a row to expand all fields

Tests (17 passing)

  • useMediaQuery.test.ts — match states + live media-change events
  • ProgressiveDisclosureCards.test.tsx — collapse/expand, per-row independence,
    keyboard focus, and a jest-axe accessibility assertion
  • InvoiceTableResponsive.test.tsx — both viewports: full <table> on desktop,
    cards (no table) on mobile

Existing InvoiceTable and KeyboardNavigation tests still pass — desktop behaviour
is unchanged.

Requirements checklist

  • Mobile (< 640px): show only key columns (Invoice ID, Status, Amount)
  • Tap a row to expand and see all fields inline
  • Desktop: full table
  • Uses useMediaQuery hook for responsive behaviour
  • Expanded state is accessible (keyboard-triggerable, aria-expanded)
  • Responsive tests for both viewports
  • Applied to invoice list, LP positions, earnings history

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Ejirowebfi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement progressive disclosure for complex data tables

1 participant