Skip to content

feat: refactor NetworkStatusIndicator — state hook, framer-motion animations, unit tests, screen reader support#997

Merged
starTecchie merged 1 commit into
starTecchie:mainfrom
presidojay1:feat/network-status-indicator-967-968-969-970
Jun 24, 2026
Merged

feat: refactor NetworkStatusIndicator — state hook, framer-motion animations, unit tests, screen reader support#997
starTecchie merged 1 commit into
starTecchie:mainfrom
presidojay1:feat/network-status-indicator-967-968-969-970

Conversation

@presidojay1

Copy link
Copy Markdown
Contributor

Summary

  • [Frontend] Refactor state logic for Network Status Indicator #967 State refactor: Network monitoring logic (health polling, interval management, status change callbacks) extracted into useNetworkMonitor custom hook, keeping the component as a pure presentation layer backed by a Zustand store (useNetworkStatusStore)
  • [Frontend] Implement framer-motion animations for Network Status Indicator #968 framer-motion animations: Status dot variants (pulse for online/checking/slow, static for offline), badge enter/exit transitions, details panel collapse animation, refresh button spin, latency color variants, connection quality bar — all via network-animations.ts with getAdaptiveTransition for reduced-motion support
  • [Frontend] Add unit tests for Network Status Indicator #969 Unit tests: Converted NetworkStatusIndicator.accessibility.test.tsx from Jest to Vitest (vi.mock, vi.fn, vi.hoisted for shared mock instances across component and tests); all test dependencies (@testing-library/react, vitest, jsdom) already present in package.json
  • [Frontend] Improve screen reader support for Network Status Indicator #970 Screen reader support: role="region" with aria-live="polite", aria-atomic, aria-busy (during checks), aria-describedby linking to details panel, role="group" on details, .sr-only live-region, aria-pressed/aria-busy on refresh button, window.online/offline event announcements via useScreenReader, Ctrl+R keyboard shortcut, Escape key restores focus

Test plan

  • npm run test:unit passes in frontend/ — main NetworkStatusIndicator.test.tsx covers rendering, status display, refresh, auto-check, ARIA attributes
  • Accessibility test suite (NetworkStatusIndicator.accessibility.test.tsx) runs without jest is not defined errors
  • Network badge in the UI shows animated dot, animated refresh icon on click, and smooth status transitions
  • Screen readers announce status changes and network connectivity events

Closes #967
Closes #968
Closes #969
Closes #970

… and screen reader support for NetworkStatusIndicator

- Extract network monitoring state logic into useNetworkMonitor hook (starTecchie#967)
- Add framer-motion animation variants for status transitions, dot pulse,
  refresh button spin, and connection quality in network-animations.ts (starTecchie#968)
- Convert NetworkStatusIndicator.accessibility.test.tsx from Jest to Vitest
  syntax (vi.mock, vi.fn, vi.hoisted for shared mock instances) (starTecchie#969)
- Add comprehensive ARIA attributes: aria-live, aria-atomic, aria-busy,
  aria-describedby, aria-pressed on refresh button, role="group" on details
  panel, sr-only announcement region, and online/offline event announcements
  via useScreenReader (starTecchie#970)
- Simplify Escape key handler in useNetworkMonitor to always restore focus
  (removes focus-equality guard that prevented restoreFocus from being called)

Closes starTecchie#967
Closes starTecchie#968
Closes starTecchie#969
Closes starTecchie#970
@starTecchie
starTecchie merged commit ce04e3a into starTecchie:main Jun 24, 2026
1 of 4 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

2 participants