Files
pipelines/app/notes/chat-code-hover-copy.md
T

1.2 KiB

Copy code on hover

Fenced blocks reveal a native Copy action in a permanently reserved header slot on mouse hover or keyboard focus. Inline backtick runs remain TextSpans and use hover callbacks to show a native floating Copy control above their glyph bounds (or below at the viewport top), leaving text gestures and wrapping untouched.

Copy writes the rendered code content without fences, language labels or backticks, preserving spaces, tabs and newlines. The shared copy button reports Copied, resets on content replacement, and ignores stale asynchronous feedback. The code control is excluded from transcript text selection.

Inline hover allows 180ms to cross onto the floating control. It cleans up on mouse exit, scrolling, route/dependency changes, text replacement and disposal. The existing fixture (chats=1&msgs=2) supplies both inline and fenced code for captures; no live chat is modified.

Checks cover both native hosts, raw clipboard contents, multiple inline runs, code inside links, keyboard activation, TextSpan structure and cleanup. Browser hover/click captures exercise block and inline Copy → Copied on both hosts. Device behaviour remains unverified; normal touch selection is preserved.