feat(loop): cycles C003+C004 — anchor + input a11y detectors & fixes#461
feat(loop): cycles C003+C004 — anchor + input a11y detectors & fixes#461HomenShum wants to merge 3 commits into
Conversation
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 latest updates on your projects. Learn more about Vercel for GitHub.
|
🤖 Augment PR SummarySummary: Improves ScratchNode proto home a11y by treating certain anchors as real buttons and extending the self-improvement loop scanner. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| let m; | ||
| while ((m = re.exec(text))) { | ||
| const a = m[1]; | ||
| if (!/\bonclick\s*=/.test(a)) continue; |
There was a problem hiding this comment.
In scripts/improvement-loop/scan.mjs (line 228), the \b(onclick|href|role)\s*= checks will also match attributes like data-onclick= / data-href= because - creates a word boundary, which can introduce both false positives and false negatives. That could skew the scanner’s evidence/line targeting and drive incorrect auto-safe actions.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| } 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.
In public/proto/home-v5.html (line 8997), this global keydown handler will auto-repeat while a key is held down, which can trigger multiple .click() activations (e.g., repeated “Republish”) and diverge from native button semantics (Space typically activates on keyup). It also only checks e.key === " ", so some older/alternate key values may not activate the control consistently across browsers.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| ### 4. IMPLEMENT | ||
| - Fresh branch off `origin/main` (`git checkout -b loop/<slug> origin/main`). | ||
| - Fresh branch off `origin/main` (`git checkout -b chore/loop-<slug> origin/main`). Use a Conventional-Commits type prefix (feat/fix/chore/docs) so the repo branch-name CI check passes — never `loop/...`. |
There was a problem hiding this comment.
In .claude/rules/self_improvement_loop.md (line 36), the example branch command hardcodes chore/loop-<slug> but the same sentence says to use a Conventional-Commits type prefix (feat/fix/chore/docs), which reads as internally inconsistent. This may lead future cycles to choose the wrong branch prefix when the change is a feat or fix.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Added detectUnlabeledInputs (aware of <label for>). Validated 11 candidates -> 2 genuinely unlabeled (notes-search-input, notes-edit-title); added aria-label to both. Rejected expanding to dead home-v2/v3/v4 prototypes (theater). e2e 7/7; scan clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pull request was closed
Self-improvement loop cycle C003 (clean rebuild on main; supersedes #459). Adds detectAnchorButtons and fixes 3 anchors-as-buttons (openWiki/startTour/snPublishWiki) with role=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 emit chore/loop-* branch names. Generated with Claude Code