Phase 2.3: Bug Fixes - Share API and Resource Links#36
Merged
AccessiT3ch merged 4 commits intophase2from Feb 2, 2026
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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
shareHandlerto 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
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
Headercomponent 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
shareHandlerinsrc/utils.jsto 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.jsto 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.jsxfor 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:
src/Components/Header/Header.jsxfor potential future rework. [1] [2]workplan.md.