Skip to content

A code block's Copy button stays 32px on a compact code block #3829

Closed

Description

@max-sixty

What happens

A code block's Copy button is a 32px bordered box (--lf-code-copy-size: var(--lf-line)) whatever the block's text size. On a compact one-line block, such as a widget's code field set at 12.5px on a 19px line, the button covers nearly the whole height of the block.

The button stands in chrome rather than inside the block (browser/runtime/block-controls.js), so a page or widget can't size it for its own blocks. --lf-code-copy-size is set on :root, and setting it on the block's container doesn't reach the button.

Expected

The button scales with the block it serves, for example to the block's line height, keeping --aim-floor as the target's minimum. Or a block, or its container, can set the size for the buttons over it.

Repro

leaf page init /tmp/size-demo
cat > /tmp/size-demo/index.html <<'HTML'
<!doctype html>
<html lang="en">
  <head>
    <title>Size demo</title>
    <meta name="description" content="A compact code block." />
    <style>
      .compact pre { font-size: 12.5px; line-height: 19px; padding: 7px 10px; }
    </style>
  </head>
  <body>
    <main class="layout-column">
      <div class="compact">
        <pre><code>echo hello</code></pre>
      </div>
    </main>
  </body>
</html>
HTML
leaf server start /tmp/size-demo

Open the printed URL and hover the code block. The block is 43px tall and its Copy button is 32px square.

Then leaf server stop /tmp/size-demo.

Seen on leaf cfb5b3a, installed 2026-10-24T08:34:50-07:00.

This was written by Claude Code on behalf of max-sixty

Activity

  1. added
    enhancement
    on Oct 24, 2026
  2. added a commit that references this issue on Oct 24, 2026
    31101a7
  3. leaf-agent commented on Oct 24, 2026

    @leaf-agent
    Collaborator

    Fixed in #3830, which has merged. The Copy face now follows a code block's line height, and a block or container can set --lf-code-copy-size for a different face. Its press target still keeps the --aim-floor minimum. The browser regression reproduced the 32px face on a 19px line before the fix and passed afterward; the PR's checks passed on the merged head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions