feat(loop): cycle C003 — anchor-as-button a11y detector + fix#459
feat(loop): cycle C003 — anchor-as-button a11y detector + fix#459HomenShum wants to merge 3 commits into
Conversation
Self-improvement loop, cycle C002 (tightened to a 30-min cadence). Loop infra (scripts/improvement-loop/scan.mjs): - +3 detectors: button-without-type (form-context aware — in-form = human-gated), target="_blank" missing rel="noopener" (reverse-tabnabbing), <img> missing alt. - +CSS/HTML comment-masking so example markup inside comments is never flagged (fixes the class of false positive seen in C001/C002). Product fix (public/proto/home-v5.html): - Added explicit type="button" to 3 buttons the loop found + I validated: the Memory Wall sticky-delete button and the two onboarding-tour buttons. All have onclick handlers and are not inside a <form>, so this is a safe best-practice fix (no behavior change). The 1 other candidate was a false positive (button in a CSS comment) — rejected, detector hardened, not "fixed". Verification: e2e 7/7 (home-v5-output-contract + scratchnode-live-route-honesty); inline scripts parse; post-fix scan is clean (loop converged). Ledger C002 recorded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Self-improvement loop, cycle C003. Loop infra (scripts/improvement-loop/scan.mjs): - +detectAnchorButtons: flags <a onclick=...> with no href and no role — anchors used as buttons that are not keyboard-focusable and are announced as links by screen readers. Product fix (public/proto/home-v5.html): - The "Open wiki", "Take the tour", and "Publish wiki" controls were such anchors. Added role="button" + tabindex="0" and one global Enter/Space keydown delegate for any a[role="button"]. No behavior change for mouse users; keyboard + SR users can now focus and activate them. Integrity note: mid-cycle I caught a self-introduced bug — an inline onkeydown with single quotes broke a JS innerHTML string (one anchor is built in a script). Validated via the inline-script parse check, reverted, and switched to the global delegate before shipping. e2e 7/7 (output-contract + honesty); post-fix scan clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The loop rule told cycles to use loop/<slug> branches, which fail the repo's (advisory) <type>/<short-slug> branch-name check. Switch to a Conventional-Commits type prefix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Superseded by a clean rebuild on updated main (stacked-PR conflict after #458 squash-merged). Reopened as a fresh chore/loop-c003-a11y branch. |
🤖 Augment PR SummarySummary: Expands the self-improvement scanner with additional deterministic a11y/security detectors and fixes several “anchors used as buttons” in the ScratchNode proto surface. Changes:
Technical Notes: The scanner still ranks auto-safe items by score and queues human-gated items (e.g., missing button type inside forms) for explicit review. 🤖 Was this summary useful? React with 👍 or 👎 |
| } catch (e) { /* no-op */ } | ||
| })(); | ||
| </script> | ||
| <script>document.addEventListener("keydown",function(e){if((e.key==="Enter"||e.key===" ")&&e.target&&e.target.matches&&e.target.matches("a[role=\"button\"]")){e.preventDefault();e.target.click();}});</script> |
There was a problem hiding this comment.
public/proto/home-v5.html:8997 — This keydown delegate can fire repeatedly while a key is held (key repeat), which could trigger multiple .click() activations for a[role="button"] actions (e.g., republish). Consider ensuring activations are single-fire per keypress, especially for Space.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| let m; | ||
| while ((m = re.exec(text))) { | ||
| const attrs = m[1]; | ||
| if (/\btype\s*=/.test(attrs)) continue; |
There was a problem hiding this comment.
scripts/improvement-loop/scan.mjs:166 — The attribute checks using \btype\s*= (and similar \bonclick, \bhref, \brole) can also match data-type=, data-onclick=, etc., which can cause detectors to miss real issues or misclassify elements. This could reduce scan correctness/coverage on real-world markup.
Severity: medium
Other Locations
scripts/improvement-loop/scan.mjs:228scripts/improvement-loop/scan.mjs:229scripts/improvement-loop/scan.mjs:230
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Self-improvement loop cycle C003 (stacked on #458). Adds
detectAnchorButtonsand fixes 3 real anchors-as-buttons (openWiki/startTour/snPublishWiki) withrole=button+tabindex=0+ a global Enter/Space keydown delegate. Caught + fixed a self-introduced quote-break mid-cycle. e2e 7/7; post-fix scan clean. Also fixes the loop rule to usechore/loop-*branch names. 🤖 Generated with Claude Code