-
Notifications
You must be signed in to change notification settings - Fork 296
Fix 2605 copy button blog page not working #2644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix 2605 copy button blog page not working #2644
Conversation
WalkthroughThe pull request enhances the copy functionality in the blog post metadata component by replacing a basic copy button with a tooltip-enabled version. The change wraps the copy button in a Melt UI Tooltip component that displays dynamic text—"Copied!" when the URL is successfully copied and "Copy" otherwise. This requires adding a copied state, updating imports, and binding the copy action to the button's click handler. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/lib/components/blog/post-meta.svelte (2)
6-8: Copy helper integration looks correctImporting
Tooltip/meltand switching toconst { copied, copy } = handleCopy(currentURL);cleanly fixes the “copy button not working” issue by using the helper as a hook and wiring a dedicatedcopyhandler pluscopiedstate.One thing to keep in mind: if
currentURLwere ever to change during the lifetime of this component,handleCopywould not be re-run. For the current blog-post use case (URL is effectively static per render) this is fine, but if you later reuse this component in a more dynamic context, consider making thehandleCopycall reactive tocurrentURL.Also applies to: 31-31
93-107: Tooltip-wrapped copy button is wired and accessibleThe tooltip integration around the non-link share action looks solid: the button uses
onclick={copy}anduse:melt={trigger}, keeps the existingaria-label, and surfaces clear feedback via$copied ? 'Copied!' : 'Copy'. This both restores the copy functionality and adds a nice UX touch.If
handleCopydoes not already resetcopiedafter a short delay, consider adding that behavior so the tooltip text returns to “Copy” automatically instead of staying on “Copied!” for the rest of the session.
What does this PR do?
The copy button on the blog post was not working (earlier).Added visual feedback tooltip displaying "Copied!" confirmation when users copy shared content to clipboard.
Earlier

Test Plan
Related PRs and Issues
#2605
Have you read the [Contributing Guidelines on issues]
Yes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.