Repository navigation
Announce v5.0 sloped sides in a floating banner - #94
Conversation
A birch strip, its left end cut on a slope with a burnt edge, floats out from under the header. A side view of a box is traced, then the sloped front glows. "Try it" switches the generator to a sloped front. - Shows once per release: dismissing or trying it is kept in localStorage under makeabox:announce:<major.minor>. - Hidden in the HTML until the controller shows it, so it never flashes. - Sits under the header and the panels; holds still under reduced motion. - Request spec for the markup; Cypress spec for show, try and dismiss.
Agents may create their own worktree under .claude/worktrees and claim files with alock. Records the CI commands, since there is no justfile.
kigster
left a comment
There was a problem hiding this comment.
Emoji review of #94. CI is green (test, lint, e2e). No blocking bugs found.
🙁 announce.css:15 the drop shadow is clipped away by the clip-path on the same element, so the banner never shows its floating shadow.
🙁 announce.css:6 left: 50% with auto width caps the banner at 50vw, so between about 641px and 1280px it is squeezed and the copy wraps to several lines.
🙁 announce.css:55 the v5.0 label (--beam on birch) is about 1.9:1 contrast, and .try:hover (--ink on --beam) about 2.6:1. Both fail WCAG AA.
🙁 _announcement.html.haml:3 the key and label follow Makeabox::VERSION, but the copy is fixed. At 5.1 it would come back saying "v5.1 Sloped sides."
🙁 announce_controller.js:34 the comment is wrong: under reduced motion the opacity transition (0.2s) is still there and transitionend fires.
🙁 CLAUDE.md:8 this PR adds CLAUDE.md alongside the feature, against the rule that same file sets.
🙁 The PR description is empty. The commit messages are good, so pasting them in would do.
👍 announce.css:25 bobbing with the separate translate property, so it stacks on the centering transform instead of fighting it.
👍 _announcement.html.haml:4 + announce.css:20 hidden in the HTML until the controller decides, so it never flashes and is simply absent without JS.
| repeating-linear-gradient(97deg, rgb(255 255 255 / 0.07) 0 2px, transparent 2px 9px), | ||
| linear-gradient(180deg, var(--birch-light), var(--birch) 60%, var(--birch-dark)); | ||
| clip-path: polygon(var(--slope) 0, 100% 0, 100% 100%, 0 100%); | ||
| filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.45)); |
There was a problem hiding this comment.
🙁 This drop-shadow never shows. Filters run before clipping, so the clip-path on line 14 cuts the shadow off along with everything else outside the polygon. To get the floating shadow, put the filter on a wrapper (or on .announce itself) and the clip-path plus birch background on an inner element or a ::after layer.
| .announce { | ||
| --slope: 26px; | ||
| position: fixed; z-index: 2; /* under the header, which it slides out of, and under the panels */ | ||
| top: calc(var(--header) + 12px); left: 50%; |
There was a problem hiding this comment.
🙁 A fixed element with left: 50% and auto width shrinks to fit inside 100vw - 50%, so it is never wider than 50vw. At 1440px that is still 720px, which is why Cypress looks fine. At 1024px it tops out at about 512px, and at 700-800px only about 100px are left for the copy after the sketch, label, button and close, so it wraps to three or four lines. Try left: 0; right: 0; margin-inline: auto; width: fit-content; and drop the -50% from the transforms, or set width: max-content alongside the existing max-width.
| .announce .words { display: flex; align-items: baseline; gap: 10px; min-width: 0; } | ||
| .announce .release { | ||
| flex: none; font: 600 24px/1 "Barlow Condensed", "Archivo", sans-serif; letter-spacing: 0.02em; | ||
| color: var(--beam); text-shadow: 0 1px 0 rgb(255 255 255 / 0.35); |
There was a problem hiding this comment.
🙁 --beam (#ff5a2b) on --birch (#e2c48f) is about 1.9:1, below even the 3:1 large-text minimum. The text-shadow does not help. .try:hover on line 67 (--ink on --beam) is about 2.6:1 for 16px text. Using --char for the version, or a darker beam shade, would fix both. The banner's aria-label already names the version for screen readers, so this is about sighted readers.
| .announce.out { opacity: 0; transform: translate(-50%, -28px); transition-duration: 0.3s; transition-delay: 0s; } | ||
|
|
||
| /* Once it has landed it keeps bobbing gently, as if it hung in the air. */ | ||
| .announce.in { animation: bob 4.2s ease-in-out 1.4s infinite; } |
There was a problem hiding this comment.
👍 Bobbing with the separate translate property rather than transform means the keyframes stack on the translate(-50%, 0) centering instead of overwriting it. Neat.
| @@ -0,0 +1,18 @@ | |||
| -# Floats out from under the header to announce what the release brought. Hidden | |||
| -# until announce_controller.js shows it, so it never flashes for someone who closed it. | |||
| - release = Makeabox::VERSION.split('.').first(2).join('.') | |||
There was a problem hiding this comment.
🙁 The storage key and the v5.0 label come from Makeabox::VERSION, but the copy ("Sloped sides.") is fixed. At 5.1 everyone who dismissed it would see it again, labelled "v5.1 Sloped sides." The request spec's hard-coded 5.0 would catch that in CI, but only by failing. Consider pinning the release to the announcement it belongs to, e.g. - release = '5.0', or render the partial only when release == '5.0', so a version bump never shows stale news.
| -# Floats out from under the header to announce what the release brought. Hidden | ||
| -# until announce_controller.js shows it, so it never flashes for someone who closed it. | ||
| - release = Makeabox::VERSION.split('.').first(2).join('.') | ||
| %aside.announce{hidden: true, 'aria-label': "New in version #{release}", |
There was a problem hiding this comment.
👍 Rendering it hidden and letting the controller decide (backed by .announce[hidden] { display: none }, needed because display: flex would otherwise win) means no flash for people who dismissed it, and no stray banner without JS.
| this.element.classList.add("out") | ||
| const hide = () => { this.element.hidden = true } | ||
| this.element.addEventListener("transitionend", hide, { once: true }) | ||
| setTimeout(hide, 600) // reduced motion has no transition to end |
There was a problem hiding this comment.
🙁 This comment is wrong. The reduced-motion block keeps transition: opacity 0.2s, so transitionend still fires there. The timeout is still a good safety net (e.g. the tab is in the background or the transition is interrupted), so keep it and just fix the comment: // in case transitionend never fires.
| - Create your own worktree without asking: `git worktree add -b <branch> .claude/worktrees/<name> origin/main`, then enter it by path and seed it with `~/.agents/bin/setup-worktree`. `.claude/` is git-ignored. | ||
| - Name the branch with `~/.agents/bin/create-branch-name <up to 4 words>`. | ||
| - Before writing, claim each file with `alock acquire <path> "<why>" -u "$REDIS_URL"`, one path per call (`acquire` takes a single scope). Release them with `alock release-all -u "$REDIS_URL"` when the PR is open. | ||
| - Keep unrelated work in separate PRs: a fix to an existing feature merges on its own, before the next feature. |
There was a problem hiding this comment.
🙁 This line says to keep unrelated work in separate PRs, and the agent notes ship in the banner PR. It does no harm, but a separate PR would follow your own rule. Line 5 ("Create your own worktree without asking") also overrides the global ask-first rule for this repo. That looks deliberate; just flagging it so it is a conscious choice.
There was a problem hiding this comment.
Keeping it here, deliberately. The PR author asked for this CLAUDE.md in the same session, as part of this work, and the "create your own worktree without asking" line is a rule the author granted for this repo. Moving it to its own PR now would mean rewriting a pushed branch (force-push), which the author's rules forbid. It is one self-contained commit (f3d8ab2), so it can be reverted or cherry-picked on its own. Leaving this thread for the author to resolve.
|
✅✅✅✅✅ Ready to merge: CI is green, the banner works and is tested, and the 🙁 items (clipped shadow, 50vw width cap, label contrast, copy tied to VERSION) are polish that can follow. |
- The shadow sits on the outer element and the sloped clip on an inner .plank, so the clip no longer cuts the shadow away. - Centred with auto margins instead of left: 50%, which capped the banner at half the viewport between 641 and 1280px. - v5.0 and the Try it hover use a darker beam (#9c2d0b): 4.5:1 on birch, 6.5:1 under white. - The release is fixed at 5.0, the one the copy describes, so a version bump does not re-announce it. - Corrects the comment on the dismiss fallback timer. - Cypress: the banner keeps its width and stays centred at 1000px.
At 1180px and below, where the header changes layout and the floating banner would cover the h1, the banner stops floating and takes its place in the page above the heading, lined up with it. Wider screens keep the floating banner. Cypress checks it floats centred at 1440px and sits above the heading at 1000px and 390px.
kigster
left a comment
There was a problem hiding this comment.
Re-review at 02e00ac. Ran the pr-review-toolkit agents (code, tests, comments, silent failures). CI is green (test, lint, e2e).
Earlier threads, checked:
👍 Shadow: fixed. The outer .announce casts the drop-shadow and the inner .plank holds the clip-path, so the shadow is no longer clipped.
👍 Width: fixed. left: 0; right: 0; margin-inline: auto; width: fit-content centres it at full width, and Cypress checks it is wider than 560px and centred within 2px at 1440px.
👍 Contrast: fixed. --deep on birch is 4.48:1 (3.12:1 at --birch-dark). That passes for the 24px/600 label, which counts as large text. The code comment's numbers are off, see inline.
👍 Stale release: fixed. release = '5.0' is pinned to the copy, and the partial explains why.
🤔 transitionend comment: changed, but the earlier review was wrong here, and the original comment was right. base.css:118 sets transition: none !important under reduced motion, so transitionend never fires there. See inline.
CLAUDE.md: the author's reasons stand. Nothing new from me.
New points:
🤔 At 901-1180px the in-flow banner pushes the control strip about 75px below the fold (announce.css:84).
🤔 The banner appears after the JS loads and shifts the page down on narrow screens (announce_controller.js:11).
🤔 The contrast comment's numbers are slightly off (announce.css:7).
🤔 The reduced-motion transition: opacity 0.2s never applies (announce.css:100).
🤔 The "stays gone" test can pass without the controller running, and no test checks hidden after a dismiss (announce.cy.js:51).
🤔 The breakpoint tests measure the box mid-animation (announce.cy.js:33).
🤔 try() reaches into the generator by CSS selector and does nothing, silently, if the selector misses (announce_controller.js:18).
👍 Geometry-based layout tests rather than screenshots (announce.cy.js:22).
Opsec: no secrets, no user input rendered, localStorage only. Nothing blocks the merge.
|
|
||
| /* Where it would cover the heading, it stops floating and takes its place in the | ||
| page instead: above the h1, lined up with it. */ | ||
| @media (max-width: 1180px) { |
There was a problem hiding this comment.
🤔 At 901-1180px this pushes the control strip below the fold. Once the banner is in the flow before main.bench, the first screen is the header, the banner (about 14px margin plus about 60px), and a .bench that still has min-height: calc(100svh - var(--header)) (generator.css:2). That min-height is only reset at max-width: 900px (generator.css:133). So at 1024 or 1152 wide, the panel with Generate starts about 75px below the fold until the banner is dismissed. The 1000x800 Cypress case only checks the banner against the h1, so it cannot catch this.
Options:
- Render the banner inside
.heroabove the h1. This also lines it up without the--guttermargin math. - Or subtract its height:
.announce:not([hidden]) + .bench { min-height: calc(100svh - var(--header) - <banner height>) }.
There was a problem hiding this comment.
Not changing this one. Moving the banner above the heading on smaller screens was an explicit request, and being in the flow is what that costs: until it is dismissed the strip sits about 75px lower. It is gone for good after one click. Leaving the thread for the author to resolve.
|
|
||
| connect() { | ||
| if (this.seen) return | ||
| this.element.hidden = false |
There was a problem hiding this comment.
🤔 At 1180px and below the banner is in the flow, so hidden = false here makes the h1, preview and panel jump down about 75px once the importmap modules have loaded. The banner itself is still at opacity 0 at that point. This happens on every first visit per release, without user input, so it counts as layout shift (CLS). Reserving the space on the server, or animating the height (grid-template-rows: 0fr to 1fr) together with the opacity, would avoid it.
There was a problem hiding this comment.
Not changing this one either. The banner ships hidden so that someone who already dismissed it never sees a flash. Reserving its space before the script runs would bring back either the flash or an empty gap for those people. A one-time 75px shift on the first visit of a release seems the better trade. Leaving the thread for the author to resolve.
| the sloped shape. (A clip-path would cut away a shadow on the same element.) */ | ||
| .announce { | ||
| --slope: 26px; | ||
| --deep: #9c2d0b; /* the beam, darkened to read on birch (4.5:1) and under white (6.5:1) */ |
There was a problem hiding this comment.
🤔 The numbers in this comment are slightly off. #9c2d0b measures:
| Background | Ratio |
|---|---|
--birch-light |
5.43:1 |
--birch |
4.48:1 |
--birch-dark (bottom of the gradient) |
3.12:1 |
--ink (.try:hover text) |
6.43:1 |
It still passes, because the 24px/600 label is large text and only needs 3:1. Suggest: /* the beam, darkened: 4.5:1 on --birch, 3.1:1 on --birch-dark (large text, needs 3:1); 6.4:1 under --ink on .try:hover */.
| this.element.classList.add("out") | ||
| const hide = () => { this.element.hidden = true } | ||
| this.element.addEventListener("transitionend", hide, { once: true }) | ||
| setTimeout(hide, 600) // in case transitionend never comes, e.g. the tab is in the background |
There was a problem hiding this comment.
🤔 My earlier comment on this line was wrong, and the original "reduced motion has no transition to end" was right. base.css:118 sets *, *::before, *::after { transition: none !important; } under prefers-reduced-motion. That beats transition: opacity 0.2s at announce.css:100, so:
transitionendnever fires for reduced-motion users, and this timeout is what hides the banner. A background tab is the least likely case, sincedismiss()runs from a click.- The opacity fade at
announce.css:100is dead code. The banner vanishes at once, then (at 1180px and below) leaves an empty gap for 600ms before the page closes up.
Suggest restoring the reduced-motion wording here, dropping the dead transition there, and hiding straight away when matchMedia('(prefers-reduced-motion: reduce)').matches.
| banner().find(".close").click() | ||
| banner().should("not.be.visible") | ||
| cy.reload() | ||
| banner().should("have.attr", "hidden") |
There was a problem hiding this comment.
🤔 This can pass without the controller ever running, because the server HTML already ships with hidden, and cy.reload does not wait for the controllers to connect. If seen broke (wrong key, a getter that always returns false), the test could still go green. Line 52's upright is the HTML default too. Wait for something the JS draws first (e.g. the stage SVG), then assert hidden and not.have.class("in").
On a related note, lines 43 and 49 only check not.be.visible, which is true as soon as the opacity reaches 0. If hide() regressed, a see-through banner (fixed, z-index 2) would stay over the hero and swallow clicks. Adding banner().should("have.attr", "hidden") there would catch that.
| cy.get(".hero h1").then(($h1) => { | ||
| const heading = $h1[0].getBoundingClientRect() | ||
| const box = Cypress.$("aside.announce")[0].getBoundingClientRect() | ||
| expect(box.bottom).to.be.at.most(heading.top) |
There was a problem hiding this comment.
🤔 This .then runs as soon as .in appears. For the next 0.6s the box is still at translateY(-28px), then it overshoots and bobs, so box.bottom <= heading.top gets up to about 28px of free slack, and the result depends on timing. Retry with .should() until getComputedStyle(el).transform === "none", then measure. Also, calling cy.viewport before cy.visit tests the narrow layout from first load rather than after a resize.
|
|
||
| // Switches the generator to a sloped front, the way choosing it by hand would. | ||
| try() { | ||
| const shape = document.querySelector('[data-generator-target="shape"]') |
There was a problem hiding this comment.
🤔 If the generator's target is ever renamed, try() skips the switch without a word, still dismisses, and stores "seen" for good. The user clicked "Try it" and got nothing. Cypress would catch it, but only there. static outlets = ["generator"] with this.generatorOutlet.shapeTarget would make Stimulus raise a clear "missing outlet" error, and announce would stop depending on generator's markup. Small thing, separate from that: line 12 says "One frame later", but the nested requestAnimationFrame waits two frames.
| /* The release banner: a strip of birch plywood that floats out from under the | ||
| header. Its left end is cut on a slope, like the front of the box it announces. | ||
| The outer element moves and casts the shadow; the plank inside is clipped to | ||
| the sloped shape. (A clip-path would cut away a shadow on the same element.) */ |
There was a problem hiding this comment.
👍 Putting the shadow on the outer element and the clip on .plank is the right fix, and the comment says why, so nobody merges the two back later.
| const box = $banner[0].getBoundingClientRect() | ||
| const middle = $banner[0].ownerDocument.documentElement.clientWidth / 2 // the viewport less its scrollbar | ||
| expect(box.width).to.be.greaterThan(560) | ||
| expect(Math.abs(box.left + box.width / 2 - middle)).to.be.lessThan(2) |
There was a problem hiding this comment.
👍 The layout is checked by real geometry (centred within 2px against clientWidth without the scrollbar, aligned with the h1 when narrow), not by screenshots. That is what caught the width bug.
|
✅✅✅✅✅ Ready to merge. The earlier fixes hold, CI is green, and nothing blocks. Seven 🤔 points are left, the main ones being the 901-1180px fold push and the layout shift; they can land here or in a follow-up. |
- Try it reaches the generator through a Stimulus outlet, so a renamed generator fails loudly instead of the button doing nothing. - The reduced-motion CSS no longer sets a transition base.css already turns off; comments say why the 600ms fallback exists and give the measured contrast. - Cypress checks the banner is hidden after a dismiss, proves the controller read its key after reload, and measures the breakpoint layout once the slide-in has landed.
Waiting for transform: none timed out on CI, where the slide-in sat at 1.2px. The test is about where the layout puts the banner, so it now turns the transforms off before measuring.
- Comment sits beside Try it and opens the Discussion panel, as the menu link does. - The banner now returns on every page load until Do not show again is ticked; the choice is saved in localStorage the moment it changes, and unticking forgets it. - Layout is a grid: wide, the text and both buttons share one row with the checkbox under the text's first word; at 900px and below the text wraps to about half the banner beside the buttons and the checkbox centres; at 480px the buttons go under the text. - The plank gets a 6px end-grain edge on the right and bottom, its top-right corner mitred at 45º. - Once landed it rocks like a seesaw (±0.45º, each end about 6.4px), and keeps still on phones. - Request spec and Cypress cover Comment, the checkbox, the return on reload, and both layouts.
No description provided.