Skip to content

Phase 2.3: Bug Fixes - Share API and Resource Links#36

Merged
AccessiT3ch merged 4 commits intophase2from
fix/phase2.3-bug-fixes
Feb 2, 2026
Merged

Phase 2.3: Bug Fixes - Share API and Resource Links#36
AccessiT3ch merged 4 commits intophase2from
fix/phase2.3-bug-fixes

Conversation

@AccessiT3ch
Copy link
Copy Markdown
Contributor

@AccessiT3ch AccessiT3ch commented Feb 2, 2026

This pull request refactors the sharing logic to prioritize the native Share API when available, improving cross-device compatibility and simplifying feature detection. It also enhances test coverage for the Header component and the sharing utility, adds more robust error handling, and introduces minor UI improvements. Manual offline functionality testing is now marked complete.

Sharing logic improvements:

  • Refactored shareHandler in src/utils.js to prioritize the native Share API when available (on both mobile and desktop), falling back to the Clipboard API only if Share API is unavailable. Removed device-type detection for simpler, more reliable feature detection. [1] [2] [3]

  • Updated and expanded tests in src/utils.error-handling.test.js to reflect new sharing logic, including prioritization of Share API, clipboard fallback, improved error handling, and success callback behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Header component and caching enhancements:

  • Added comprehensive tests to src/Components/Header/header.test.jsx for the Save button, covering scenarios like cache completion, offline warnings, spinner during caching, partial cache failures, complete failures, and install prompt edge cases. [1] [2] [3] [4]

  • Minor UI update in src/Components/Resources/ResourceModal.jsx: set Save button to render as an anchor element for improved accessibility and navigation.

UI and documentation updates:

  • Commented out the offline/online indicator in src/Components/Header/Header.jsx for potential future rework. [1] [2]
  • Marked manual offline functionality testing as complete in workplan.md.

Phase 2.3 bug fixes:

Bug 1: Share API Detection
- Remove mobile/desktop distinction for Share API
- Prioritize navigator.share when available (any platform)
- Fall back to clipboard API when share not available
- Fixes Android apps incorrectly reporting no Share API

Bug 2: Resource Modal Links
- Add as="a" prop to Button components to ensure proper anchor rendering
- All resource links now correctly open in new tabs
- Fixes California Rapid Response Networks links opening in same tab

Also:
- Update all shareHandler tests to reflect new prioritization logic
- Renumber Update Strategy section from 2.3 to 2.4 in workplan
- Update workplan with Phase 2.3 bug fix details

Tests: All 234 tests passing
Import cache utilities and expand Header tests to cover caching and install flows. Added tests to verify: already-cached message when resources are complete; loading spinner while caching; partial success alert when some resources fail; error alert when caching throws; and handling a beforeinstallprompt event without a userChoice property. Mocks for cacheUtils (isCached, cacheResources), navigator.onLine, and matchMedia are used to exercise different states.
@AccessiT3ch AccessiT3ch requested a review from Copilot February 2, 2026 23:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the sharing logic to prioritize the native Share API across all platforms (mobile and desktop) when available, falling back to the Clipboard API only when necessary. This improves cross-device compatibility by removing device-type detection in favor of feature detection. The PR also adds comprehensive test coverage for the Header component's Save button functionality and makes a minor accessibility improvement to resource links.

Changes:

  • Refactored shareHandler to prioritize Share API over Clipboard API regardless of device type
  • Expanded test coverage for sharing logic and Header component Save button scenarios
  • Updated ResourceModal to render Save button as anchor element for accessibility

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
workplan.md Marked offline functionality testing as complete and added Phase 2.3 bug fixes section
src/utils.js Refactored shareHandler to prioritize Share API and simplified feature detection
src/utils.error-handling.test.js Updated tests to reflect new Share API prioritization logic
src/Components/Resources/ResourceModal.jsx Added as="a" prop to Save button for accessibility
src/Components/Header/header.test.jsx Added comprehensive tests for Save button caching scenarios
src/Components/Header/Header.jsx Commented out offline/online indicator
Comments suppressed due to low confidence (1)

src/utils.error-handling.test.js:101

  • Test name references 'mobile' behavior, but the refactored logic is now platform-agnostic. This test duplicates the 'falls back to Clipboard API when Share API not available' test on line 64. Consider removing this test or renaming it to test a distinct scenario.
    it("falls back to clipboard on mobile when Share API not available", async () => {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread workplan.md Outdated
Comment thread src/utils.error-handling.test.js Outdated
Comment thread src/utils.error-handling.test.js
AccessiT3ch and others added 2 commits February 2, 2026 15:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@AccessiT3ch AccessiT3ch merged commit 7197cef into phase2 Feb 2, 2026
1 check passed
@AccessiT3ch AccessiT3ch deleted the fix/phase2.3-bug-fixes branch February 2, 2026 23:06
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.

2 participants