Add a copy button to the agent prompt - #3
Open
FurkaanBoraa wants to merge 1 commit into
Open
Conversation
The whole section asks the reader to paste something into their agent, but the block was not cleanly selectable: the you> prefixes and the two comment lines sit in the same text flow, so dragging across it yields you> https://github.com/RectZones/RectZones you> install this # agent… which is not what anyone wants on their clipboard. The button copies exactly the two you> lines and nothing else. The button floats rather than being absolutely positioned, so it only shortens the lines it sits beside and the comment lines keep their width. Positioning it absolutely needed padding on the whole block, which wrapped the comments onto two extra lines. First script on the site: ~15 lines, no dependency, no build step. It copies only what is already visible, so the block on screen stays the source of truth for what lands on the clipboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You did not ask for this one — it is a proposal, not a follow-up to anything you assigned. Close it without ceremony if you disagree; nothing else depends on it.
Why
The
#agentsection is the site's flagship path — it is one of the two hero CTAs and the row you win outright in the comparison table. Its entire call to action is paste this into your agent. But the block cannot be cleanly selected by hand: theyou>prefixes and the two comment lines share the same text flow, so dragging across it puts this on the clipboard:Nobody can paste that. So the button is less a convenience than a fix for a path we actively advertise.
What it copies
Exactly the two
you>lines, nothing hidden:Deliberately identical to what is on screen. A copy button that quietly copies something richer than the visible block would be a small dishonesty on a page that trades on being checkable.
Two implementation notes
It floats, it is not absolutely positioned. Absolute positioning needs
padding-righton the whole block, which pushed both comment lines onto a second line each and grew the block from 7 rendered lines to 9. A float only shortens the lines it actually sits beside, so the comments keep their width. Verified the block's rendered line count is unchanged frommain.This is the site's first script — around 15 lines, no dependency, no build step, no new request. If you would rather the page stay pure HTML/CSS, that is a completely reasonable line to hold and I will close this.
Verification
Served the page and drove a real browser rather than reading the diff:
navigator.clipboard.writeTexthttps://github.com/RectZones/RectZones\ninstall thisCopied, turns--okgreenmin-width: 70pxholds the button acrossCopy/Copied/Select it[data-state="done"]vs:hovercascade<button>,:focus-visiblering in--azureOn failure the label becomes
Select itin amber rather than silently doing nothing —navigator.clipboardneeds a secure context, and a button that looks like it worked when it did not is worse than one that admits it.One honest caveat: the block already scrolls horizontally on very narrow screens because
https://github.com/RectZones/RectZonesis a single unbreakable token. MeasuredscrollWidthwith and without the button at the same width — 353 px both ways, so this PR does not make it worse, but the button does scroll with the content there.Note
Opened from a fork —
pullonly on this repo. Independent of #2 (the security-policy footer link); either can merge first, they touch different parts of the file.