fix(invite): use native share on mobile for Copy Join Link button #321
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.
Summary
Fixes #311 - "Copy share link didn't work on mobile"
This PR fixes the "Copy Join Link" button in the Manage Members modal, which was failing on iOS Chrome and other mobile browsers.
Problem
The "Copy Join Link" button was displaying "Copy failed, but here's the link" on mobile devices, particularly iOS Chrome. Users had to manually select and copy the link text, which was a poor experience.
Root Cause
navigator.clipboard.writeText()requires a secure context and synchronous user gestureexecCommand('copy')method was also unreliable on mobile browsersSolution
1. Use Native Share on Mobile Devices
On mobile (iOS/Android), the "Copy Join Link" button now uses the native share API (
navigator.share()) instead of clipboard copy:2. Improved Clipboard Fallback
For desktop browsers without modern clipboard API:
absolutewith-9999pxtofixedwithopacity: 0focus()call beforeselect()for better browser compatibilitytextarea.value.lengthinstead of hardcoded999993. Better Error Handling
AbortError)Testing
Mobile (iOS Chrome)
Desktop (Chrome/Firefox/Safari)
Fallback
Technical Details
Changes in
src/components/ManageMembersModal.tsx:Mobile Detection:
Share API Usage:
Related Issues
Closes #311
🤖 Generated with Claude Code