Skip to content

fix(transactions): show offline feedback for disabled export button - #421

Merged
therealjhay merged 2 commits into
Betta-Pay:mainfrom
Deyanju23:fix/network-tooltip-export-feedback
Jul 28, 2026
Merged

fix(transactions): show offline feedback for disabled export button#421
therealjhay merged 2 commits into
Betta-Pay:mainfrom
Deyanju23:fix/network-tooltip-export-feedback

Conversation

@Deyanju23

Copy link
Copy Markdown
Contributor

Closes #298

Summary

Improve the offline user experience for the CSV Export action by ensuring disabled buttons provide clear visual and accessible feedback.

Problem

The Export CSV button is disabled while offline, but if NetworkTooltip fails to render for disabled elements, users receive no explanation. This creates a confusing experience and provides insufficient feedback for assistive technology users.

Solution

  • Verify NetworkTooltip renders correctly for the disabled Export button.
  • Ensure a tooltip explains why the action is unavailable when offline.
  • Add an accessible aria-label stating "Export unavailable while offline."
  • Preserve existing online export behavior.

Implementation Details

Transactions Page

Updated:

  • app/(merchant)/transactions/page.tsx

Changes include:

  • Verified or corrected NetworkTooltip behavior for disabled actions.
  • Displayed an explanatory tooltip when offline.
  • Added an offline-specific aria-label for screen readers.
  • Preserved existing export functionality when online.

Accessibility

  • Added aria-label="Export unavailable while offline" while the action is disabled.
  • Ensured the explanation is available to keyboard and assistive technology users.
  • Maintained existing focus and interaction patterns.

Testing Checklist

  • Export button is disabled while offline.
  • Tooltip displays the offline explanation.
  • Tooltip is hidden when online.
  • Screen readers receive the correct aria-label.
  • Export works normally when online.
  • No visual regressions introduced.

Screenshots

N/A (Small frontend UX/accessibility improvement)

- Add lib/hooks/useOnlineStatus.ts
  Reactive hook that tracks navigator.onLine via online/offline window events.
  SSR-safe (defaults to true when window is undefined).

- Add components/shared/NetworkTooltip.tsx
  Conditional tooltip wrapper for disabled actions. Uses @base-ui's render prop
  on TooltipTrigger to substitute the default <button> with a focusable <span>,
  bypassing the browser's suppression of pointer/focus events on disabled elements.
  Transparent passthrough when online — zero overhead on the happy path.

- Update app/(merchant)/transactions/page.tsx
  - Import useOnlineStatus and NetworkTooltip
  - Disable Export CSV button when offline (disabled + aria-disabled)
  - Add aria-label='Export unavailable while offline' for screen readers
  - Wrap button in NetworkTooltip for hover/keyboard tooltip feedback
  - Add handleExportCsv stub guarded by isOnline check

- Add __tests__/TransactionsPage.test.tsx — 16 tests covering:
  - Disabled state and aria-label/aria-disabled when offline
  - Tooltip content, role, and presence when offline
  - No tooltip rendered when online
  - No offline aria-label when online
  - Connectivity transitions (offline → online)
  - Regression guard for existing page functionality
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Deyanju23 is attempting to deploy a commit to the therealjhay's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Deyanju23 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

@therealjhay
therealjhay merged commit 3e75947 into Betta-Pay:main Jul 28, 2026
0 of 5 checks passed
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.

Export CSV button is disabled when offline but shows no explanation

2 participants