Skip to content

fix: position copy button top-right and always visible in code blocks#42

Merged
hongyi-chen merged 2 commits intomainfrom
fix/copy-button-top-right
May 8, 2026
Merged

fix: position copy button top-right and always visible in code blocks#42
hongyi-chen merged 2 commits intomainfrom
fix/copy-button-top-right

Conversation

@dannyneira
Copy link
Copy Markdown
Member

@dannyneira dannyneira commented May 8, 2026

Summary

Fixes the copy-to-clipboard button positioning and visibility in Expressive Code code blocks across the docs site.

Problems fixed:

  • For bash/sh/shell blocks without a title, EC's --button-spacing variable is sized for the terminal titlebar (which we hide) — this pushed the copy button to the bottom of, or past, short code blocks
  • The button was hidden with opacity: 0 until hover (via EC's @media (hover: hover) rule), making it non-discoverable

Changes

src/styles/warp-components.css

  • Always visible at reduced opacity — overrides EC's opacity: 0 default inside @media (hover: hover) to 0.4, so the button is subtly visible at rest. EC's existing higher-specificity rules handle the progression: 0.75 on frame hover, 1.0 on button hover
  • Pinned to top-right corner — directly overrides inset-block-start and inset-inline-end on .copy for all untitled frames (0.5rem each), bypassing the problematic --button-spacing variable. Titled frames (with a visible tab/filename bar) are unaffected

GIFs

Before:

CleanShot 2026-05-08 at 13 06 45

After:

CleanShot 2026-05-08 at 13 05 53

Co-Authored-By: Oz oz-agent@warp.dev

Oz conversation

@cla-bot cla-bot Bot added the cla-signed label May 8, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 8, 2026 9:15pm

Request Review

Copy link
Copy Markdown
Member Author

@dannyneira dannyneira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a CSS-only change that fixes two issues with the copy-to-clipboard button in Expressive Code blocks: it was pushed out of position on short untitled terminal blocks, and was completely hidden until hover. The implementation is technically sound and well-commented, closely following the existing CSS patterns in the file. Found: 0 critical, 0 important, 1 suggestion, 1 nit. Recommendation: Approve with nits.

Comment thread src/styles/warp-components.css
Comment thread src/styles/warp-components.css Outdated
dannyneira and others added 2 commits May 8, 2026 21:13
- Override EC's large --button-spacing for untitled terminal frames,
  which was pushing the copy button into/past the bottom of short blocks
- Directly set inset-block-start and inset-inline-end on .copy for all
  untitled frames (0.5rem each) so the button sits cleanly inside the
  top-right corner regardless of frame type
- Always show the button at 0.4 opacity via @media(hover:hover) override
  so users can discover it without having to hover first; EC's existing
  higher-specificity rules step it up to 0.75 on frame hover and 1.0
  on button hover

Co-Authored-By: Oz <oz-agent@warp.dev>
- Add :root[data-theme='light'] opacity: 0.6 override inside @media (hover: hover)
  so the button is visible against the faint light-mode button surface
- Fix comment typo: @media(hover:hover) → @media (hover: hover)

Co-Authored-By: Oz <oz-agent@warp.dev>
@hongyi-chen hongyi-chen merged commit 4cf06d5 into main May 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants