Skip to content

feat: add error-boundary fallback UI for NotificationBell (Closes #833) - #874

Open
waterWang wants to merge 1 commit into
Predictify-org:mainfrom
waterWang:feat/notification-bell-error-boundary-833
Open

feat: add error-boundary fallback UI for NotificationBell (Closes #833)#874
waterWang wants to merge 1 commit into
Predictify-org:mainfrom
waterWang:feat/notification-bell-error-boundary-833

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Adds a compact, accessible error-boundary fallback UI for the NotificationBell component, so a render error in the bell never crashes the surrounding header.

Changes

  • src/pages/NotificationBell.tsx
    • Extracted the existing bell into an internal NotificationBellInner renderer.
    • Added a NotificationBellErrorFallback — a compact 44×44px slot with an AlertCircle icon and a pinned Retry button.
    • Wrapped the inner bell in the existing ErrorBoundary component, so any render error shows the fallback instead of blanking the header.
    • Retry resets the boundary by bumping a key (forcing a clean remount).
  • src/pages/__tests__/NotificationBell.error-boundary.test.tsx (new)
    • Verifies the bell renders normally with no error.
    • Verifies the compact fallback (with Retry) is exposed when the bell throws.
    • Verifies Retry re-renders the bell.
    • Verifies accessibility: role="alert", aria-hidden on the icon, accessible name on the Retry button.
  • src/pages/__tests__/WalletModal.test.tsx
    • Adds a @/constants/wallet-kits.constant mock to fix an ESM import failure (stellar-wallets-kit) that was breaking the WalletModal suite in JSDOM.

Accessibility (WCAG 2.1 AA)

  • Fallback container uses role="alert" so assistive tech announces the error.
  • Decorative icons are aria-hidden; the Retry button has a descriptive aria-label.
  • Uses design tokens (text-destructive, bg-destructive, ring-ring) for light + dark mode consistency.

Testing

All 3 NotificationBell test suites pass (36 tests total), including the pre-existing reduced-motion suite.

Closes #833

…dictify-org#833)

- Add compact NotificationBellErrorFallback with AlertCircle icon + Retry action
- Wrap NotificationBell with ErrorBoundary so render errors don't crash the header
- ErrorBoundary retry resets the error state via key change
- Add focused tests for error-boundary state, retry behaviour, and accessibility
- Fix WalletModal test by adding wallet-kits mock for ESM compatibility

Design:
- Compact fallback keeps the button slot (44×44px) to avoid layout shift
- Uses design tokens (text-destructive, bg-destructive, ring-ring)
- Retry button is pinned to the bottom-right corner of the fallback
- WCAG 2.1 AA: role=alert, aria-label on retry, aria-hidden on icons
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@waterWang is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Polish NotificationBell error-boundary fallback UI [b#099]

1 participant