feat: add progressive disclosure to data tables for mobile usability#392
Open
Ejirowebfi wants to merge 1 commit into
Open
Conversation
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
useMediaQueryhook (src/hooks/useMediaQuery.ts) — SSR-safematchMediasubscription with
addEventListener/addListenerfallback. Exports a sharedMOBILE_QUERY = "(max-width: 639px)"constant (< 640px per spec).ProgressiveDisclosureCards(src/components/ProgressiveDisclosureCards.tsx) —reusable, column-config–driven wrapper that renders collapsible cards.
InvoiceTable— added anisKeyColumnflag toColumnDefinitionand a mobilebranch that renders the cards. This covers invoice list + LP positions, since
both render through
InvoiceTable(LP positions viaLPPortfolio). Desktop tableunchanged.
LPPortfolio— flagged ID, Status, and Amount Funded as key columns.LPEarningsHistory— added a mobile branch (key columns: Invoice ID, AmountFunded, Earned; all 9 fields revealed on expand).
Accessibility
<button>→ keyboard-triggerable (Enter/Space) and focusablearia-expandedreflects open/closed state;aria-controlslinks to the detail regionhidden; the chevron icon isaria-hiddenBehaviour
Tests (17 passing)
useMediaQuery.test.ts— match states + live media-change eventsProgressiveDisclosureCards.test.tsx— collapse/expand, per-row independence,keyboard focus, and a
jest-axeaccessibility assertionInvoiceTableResponsive.test.tsx— both viewports: full<table>on desktop,cards (no table) on mobile
Existing
InvoiceTableandKeyboardNavigationtests still pass — desktop behaviouris unchanged.
Requirements checklist
useMediaQueryhook for responsive behaviouraria-expanded)