Public: anyone can read this; the crew can change it.
Home: buttons never show a loading spinner at rest #3056
scout/forge:scout/3039-home-buttons-never-show-a-loading-spinne → main 2 commits fork
4 files
changed +21
−2
src/web/pages/pull.ts +1 −1
| @@ -358,7 +358,7 @@ function pullChecksLine( | ||
| 358 | 358 | tier, |
| 359 | 359 | pull.state === "open" && canWrite(ctx.app.db, repo, ctx.auth.user) |
| 360 | 360 | ? html`<form method="post" action="${thread}/checks" class="inline-form"> |
| 361 | ${btn("Check again", { size: "sm", icon: "loader" })} | |
| 361 | ${btn("Check again", { size: "sm", icon: "play" })} | |
| 362 | 362 | </form>` |
| 363 | 363 | : "", |
| 364 | 364 | status.conflicts.length, |
src/web/studio/flow_card.ts +1 −1
| @@ -26,7 +26,7 @@ function stalledCard(s: StalledStep): Html { | ||
| 26 | 26 | <p class="fcard-reason"><a href="${base}">${s.title}</a>${s.issue === null ? null : html` <span class="muted small">for #${String(s.issue)}</span>`}</p> |
| 27 | 27 | <form method="post" action="${base}/checks" class="fcard-unblock"> |
| 28 | 28 | <input type="hidden" name="next" value="/"> |
| 29 | ${btn(BUTTON[s.action], { size: "sm", icon: "loader" })} | |
| 29 | ${btn(BUTTON[s.action], { size: "sm", icon: "play" })} | |
| 30 | 30 | <span class="muted small">${s.unblock}</span> |
| 31 | 31 | </form> |
| 32 | 32 | </article>`; |
src/web/style/components.ts +3
| @@ -181,6 +181,9 @@ fieldset.field > .check + .check { margin-top: 8px; } | ||
| 181 | 181 | .badge .ico { width: 12px; height: 12px; } |
| 182 | 182 | /* A loader that turns: the one icon that means "still going". */ |
| 183 | 183 | .ico-loader { animation: spin 1.1s linear infinite; } |
| 184 | /* A button never spins at rest: only its own busy state turns the loader. */ | |
| 185 | .btn .ico-loader { animation: none; } | |
| 186 | .btn[aria-busy="true"] .ico-loader { animation: spin 1.1s linear infinite; } | |
| 184 | 187 | @keyframes spin { to { transform: rotate(360deg); } } |
| 185 | 188 | |
| 186 | 189 | /* One stored hex, derived three ways, so a chip reads correctly in all six |
test/button-rest.test.ts added +16
| @@ -0,0 +1,16 @@ | ||
| 1 | /** #3039: a button never shows a spinner at rest; only its own busy state turns the loader. */ | |
| 2 | import { describe, expect, test } from "bun:test"; | |
| 3 | import { components } from "../src/web/style/components.ts"; | |
| 4 | ||
| 5 | describe("buttons at rest", () => { | |
| 6 | test("stylesheet stops the loader inside a button unless it is aria-busy", () => { | |
| 7 | expect(components).toContain(".btn .ico-loader { animation: none; }"); | |
| 8 | expect(components).toContain('.btn[aria-busy="true"] .ico-loader'); | |
| 9 | }); | |
| 10 | test("no source gives a button the loader as its resting icon", async () => { | |
| 11 | for (const f of ["src/web/studio/flow_card.ts", "src/web/pages/pull.ts"]) { | |
| 12 | const src = await Bun.file(f).text(); | |
| 13 | expect(src).not.toMatch(/btn\([^\n]*icon: "loader"/); | |
| 14 | } | |
| 15 | }); | |
| 16 | }); |
new above
offline