Skip to content

Stop the code editor's copy button collapsing to a squashed stadium - #12

Merged
StanBarrows merged 1 commit into
mainfrom
fix/code-editor-copy-button-stretch
Aug 4, 2026
Merged

Stop the code editor's copy button collapsing to a squashed stadium#12
StanBarrows merged 1 commit into
mainfrom
fix/code-editor-copy-button-stretch

Conversation

@StanBarrows

Copy link
Copy Markdown
Contributor

The bug

CodeEditor's copyable button renders as a squashed stadium with the copy glyph spilling out of it, top and bottom.

The button sits in a deliberately zero-height sticky row so it claims no layout:

<div class="sticky top-0 z-10 flex h-0 justify-end">

That row sets no align-items, so flexbox's stretch default sized the button to the row's height — zero. The button collapsed to padding + border only (24x10), while the 16px icon inside kept its size and overflowed.

The fix

Add items-start so the button keeps its intrinsic size. One class; the sticky/zero-height behaviour it was written for is untouched.

Verification

  • New test in tests/interactions.spec.ts asserts the button stays square and is taller than the glyph it wraps. It fails on main (height 10 vs icon 16) and passes with the fix.
  • Full suite green: 199 passed. lint and typecheck clean.

🤖 Generated with Claude Code

The copy affordance lives in a `sticky top-0 flex h-0 justify-end` row so it
claims no layout. With no `align-items`, the flex default of `stretch` sized
the button to that row's zero height: it rendered as a padding-only 24x10
stadium with the 16px copy glyph spilling out top and bottom.

Pin the row to `items-start` so the button keeps its intrinsic size, and
guard it with a test asserting the button stays square and still contains
its own icon.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@StanBarrows
StanBarrows merged commit 9ffa935 into main Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant