Skip to content

bug: Compare share action does not handle Clipboard API failures gracefullyΒ #7291

Description

@dnyaneshwari44

Description

Summary

The Compare page currently uses the Clipboard API to copy the generated comparison URL, but the implementation does not handle promise rejections or provide any fallback when the copy operation fails.

If clipboard access is denied, unavailable, or unsupported by the user's browser, the share action silently fails without notifying the user. As a result, users may incorrectly assume that the comparison URL has been copied successfully.

This impacts the reliability and usability of the share functionality across browsers and environments where Clipboard API support is restricted.


Technical Evidence

Affected File

  • app/compare/CompareClient.tsx

Affected Component

  • CompareClient

Affected Function

  • handleShareBattle()

Steps to Reproduce

  1. Open the Compare page.
  2. Generate a comparison URL.
  3. Deny Clipboard permission (or use a browser/environment where Clipboard API is unavailable).
  4. Click the Share button.
  5. Observe that the copy operation fails silently.

Expected Behavior

  • Clipboard API promise rejections should be handled gracefully.
  • Users should receive feedback when copying fails.
  • A fallback mechanism should be considered where supported.

Screenshots / Logs

Evidence

The current implementation invokes the Clipboard API:

navigator.clipboard.writeText(url).then(...)

According to the current implementation (app/compare/CompareClient.tsx:989), the returned promise does not include a rejection handler (.catch()) or any fallback mechanism.

If the Clipboard API operation fails, the failure is silently ignored and no feedback is provided to the user.


GitHub Username (If applicable)

No response

Environment

Chrome

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions