Skip to content

fix: add aria-label and error handling to copy profile URL button#309

Open
mrunalC27 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
mrunalC27:fix/copy-profile-url-aria-label
Open

fix: add aria-label and error handling to copy profile URL button#309
mrunalC27 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
mrunalC27:fix/copy-profile-url-aria-label

Conversation

@mrunalC27
Copy link
Copy Markdown

@mrunalC27 mrunalC27 commented May 18, 2026

Summary

Adds aria-label="Copy profile URL" to the copy button in the settings page, and adds proper .then().catch() error handling to navigator.clipboard.writeText() so "Copied!" only shows when the copy actually succeeds.

Closes #218

Type of Change

  • Bug fix

Changes Made

  • Added aria-label="Copy profile URL" to the copy button for screen reader accessibility
  • Added type="button" to prevent accidental form submission
  • Wrapped navigator.clipboard.writeText() in .then().catch() so setCopied(true) only runs on success
  • Added empty .catch(() => {}) to silently handle clipboard failures

How to Test

  1. Go to http://localhost:3000/dashboard/settings
  2. Find the Share Profile section with the profile URL
  3. Click the Copy button — it should show "Copied!" for 2 seconds then revert to "Copy"
  4. Open DevTools (F12) → Elements tab → inspect the button and confirm aria-label="Copy profile URL" is present
  5. In DevTools Console, run navigator.clipboard.writeText = () => Promise.reject('denied') to simulate clipboard failure, then click Copy — button should NOT show "Copied!"

Screenshots (if UI change)

No visual change — the button looks the same but is now accessible and reliable.

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

@mrunalC27 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thanks for your first PR on DevTrack! 🎉

A maintainer will review it within 48 hours. While you wait:

  • Make sure CI is passing (type-check + lint)
  • Double-check the PR description is filled out and the issue is linked
  • Feel free to ask questions in Discussions if you need help

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.

[GOOD FIRST ISSUE] Add copy-to-clipboard button for public profile URL in share section

1 participant