Add copy feedback to heading anchors#118
Conversation
Co-Authored-By: Oz <oz-agent@warp.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds an inline script and global styles to make Starlight heading anchors copy the absolute section URL and show temporary copy feedback.
Concerns
- Rapid repeat clicks can permanently leave a heading anchor with the temporary "Copied section link to clipboard" accessible label after the visible feedback disappears.
- The legacy clipboard fallback does not check whether
execCommand('copy')actually succeeded, so it can report success even when no copy occurred.
Verdict
Found: 0 critical, 1 important, 1 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| textarea.select(); | ||
|
|
||
| try { | ||
| document.execCommand('copy'); |
There was a problem hiding this comment.
💡 [SUGGESTION] document.execCommand('copy') returns false when the copy fails; reject in that case so the existing catch path preserves normal anchor navigation instead of showing copied feedback for a failed copy.
Co-Authored-By: Oz <oz-agent@warp.dev>
Summary
Testing
npm --prefix /Users/rachaelrenk/Documents/Warp/docs run typechecknpm --prefix /Users/rachaelrenk/Documents/Warp/docs run buildgit -C /Users/rachaelrenk/Documents/Warp/docs --no-pager diff --checkNote:
npm --prefix /Users/rachaelrenk/Documents/Warp/docs run lint -- src/components/CustomHead.astrocould not run locally becausetrunkis not installed on PATH.Co-Authored-By: Oz oz-agent@warp.dev