Files
bip-kit/test
CatoandClaude Opus 5 6b4d1fde07 fix(styles): clear the copy button off the code it covers (v0.2.5) (#27)
The copy button is absolutely positioned over the top-right of the code
block with an opaque background, and the code had symmetric 1rem padding —
so any opening line long enough to reach the button rendered underneath it.
Measured on live pages with a clipping-aware probe: 3 of 4 blocks on one
orangecat article at 1440px, and 4 of 4 at 390px, had ~1800px² of code
painted under the button. Invisible to all 145 existing tests, because the
button and the <pre> are siblings and the HTML is identical either way.

The clearance is vertical, not a right-hand gutter. Trailing padding on the
<pre> fixes nothing: a scroll container lays its padding out past the END of
the scrollable content, so a long line still passes beneath the button at
scrollLeft 0 — verified, it cleared 0 of 7 affected blocks. Narrowing the
non-scrolling wrapper does work, by clipping the <pre> short of the button,
but costs 5rem of code width on every line and hurts most at 390px where
code is already scrolling. Starting the text below the button costs 28px of
height once per block and leaves the reading width intact.

Print reclaims the clearance, since print already hides the button.

test/styles.test.js gains two guards, mutation-proven six ways: removing the
clearance, shrinking it below the button, moving the button past it, swapping
in the horizontal padding that does not work, and dropping the print reset
each turn the relevant test red, while the unmutated tree stays green.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 11:23:59 -07:00
..