Skip to content

fix : copyTextToClipboard fallback to deprecated document.execComman…#2000

Merged
dipexplorer merged 2 commits into
RatLoopz:mainfrom
hrx01-dev:fix/copyTextToClipboard-fall-back-to-deprecated-document.execCommand-without-userwarning
Jun 17, 2026
Merged

fix : copyTextToClipboard fallback to deprecated document.execComman…#2000
dipexplorer merged 2 commits into
RatLoopz:mainfrom
hrx01-dev:fix/copyTextToClipboard-fall-back-to-deprecated-document.execCommand-without-userwarning

Conversation

@hrx01-dev

Copy link
Copy Markdown
Contributor

…d without user warning

🛑 STOP: Assignment & File Scope Check

  • I am assigned to this issue.
  • I verified that this PR ONLY touches the required files.

Warning

PRs with unrelated files will not be reviewed and may be closed.

📋 PR Summary & Link

  • **Closes [BUG] scan/page.tsx copyTextToClipboard falls back to deprecated document.execCommand without user warning #1958 **
  • Summary:
    • Added a try/catch block around document.execCommand('copy') inside copyTextToClipboard. This ensures that if both the modern Clipboard API and the legacy fallback fail (which can happen in certain highly restricted browser environments), the function gracefully returns false instead of throwing an unhandled exception.
    • Refactored handleCopyMedicineDetails to await the result of the copy operation and explicitly check the boolean return value.
    • Users will now see a localized success toast when copying works and a clear error toast ("Failed to copy. Please copy manually.") if the operation fails, preventing the confusion of a "false positive" success message.

📸 Proof of Work (Screenshots / Logs)

Important

No Pull Request will be merged without proof of testing!

  • Frontend/UI changes: You MUST attach screenshots or screen recordings (GIFs/Videos) showing the UI changes.

Please drag & drop your screenshots/GIFs here:

🏷️ PR Type

  • 🐛 type: bug
  • type: feature
  • 📖 type: docs
  • 🧪 type: testing
  • 🔒 type: security
  • type: performance
  • 🎨 type: design
  • ♻️ type: refactor
  • 🛠️ type: devops
  • type: accessibility

✅ Checklist

  • My PR has a linked issue (Closes #123)
  • I have pulled the latest main and resolved any conflicts

…ted-document.execCommand-without-userwarning
@dipexplorer dipexplorer merged commit 7af47d7 into RatLoopz:main Jun 17, 2026
9 of 11 checks passed
@github-project-automation github-project-automation Bot moved this from 📥 Backlog to 🎉 Merged in SahiDawa Workflow Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @hrx01-dev! Your Pull Request "fix : copyTextToClipboard fallback to deprecated document.execComman…" has been successfully merged by @dipexplorer.

Thank you for your valuable contribution to SahiDawa! 🇮🇳
If this was for GSSoC 2026, your work is officially merged and valid. Keep up the great work and feel free to claim other open issues. 🚀

Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers gssoc:approved Approved for gssoc level:beginner 20 pts quality:clean multiplier x1.2 type:bug Something isn't working

Projects

Status: 🎉 Merged

Development

Successfully merging this pull request may close these issues.

[BUG] scan/page.tsx copyTextToClipboard falls back to deprecated document.execCommand without user warning

2 participants