fix(transactions): show offline feedback for disabled export button - #421
Merged
therealjhay merged 2 commits intoJul 28, 2026
Merged
Conversation
- 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
|
@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. |
|
@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! 🚀 |
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.
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
NetworkTooltipfails to render for disabled elements, users receive no explanation. This creates a confusing experience and provides insufficient feedback for assistive technology users.Solution
NetworkTooltiprenders correctly for the disabled Export button.aria-labelstating "Export unavailable while offline."Implementation Details
Transactions Page
Updated:
app/(merchant)/transactions/page.tsxChanges include:
NetworkTooltipbehavior for disabled actions.aria-labelfor screen readers.Accessibility
aria-label="Export unavailable while offline"while the action is disabled.Testing Checklist
aria-label.Screenshots
N/A (Small frontend UX/accessibility improvement)