fix(ui): make readme markdown copy work in safari#2182
fix(ui): make readme markdown copy work in safari#2182MathurAditya724 wants to merge 3 commits intonpmx-dev:mainfrom
Conversation
…ipboard legacy fallback
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a client-side conditional prefetch for README markdown (runs when Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
app/pages/package/[[org]]/[name].vue
Outdated
| let markdown = readmeMarkdownData.value?.markdown | ||
| if (!markdown) { | ||
| await fetchReadmeMarkdown() | ||
| markdown = readmeMarkdownData.value?.markdown | ||
| } |
There was a problem hiding this comment.
I tried this out in a webkit based browser and it didn't work for me, but that kinda seems like it makes sense since there is still an async action happening. There is this blog post that seems promising, but I haven't managed to get it to work so far - will try again later
https://wolfgangrittner.dev/how-to-use-clipboard-api-in-safari/
|
I re-tested this on WebKit/Safari with the latest changes and it now works reliably, including the first click after navigation. I added a loading state + markdown prefetch, and kept the clipboard legacy fallback. Here’s a quick demo - Screen.Recording.2026-03-22.at.12.34.08.PM.mp4 |
🔗 Linked issue
Fixes #2151
🧭 Context
The "Copy as Markdown" button in the README section wasn’t working in Safari.
It could fail silently because we were waiting for an async fetch before writing to clipboard.
📚 Description
This PR makes the README copy flow more reliable in Safari:
legacymode so it can fall back toexecCommand('copy')when neededResult: "Copy as Markdown" now works consistently, including Safari.