Skip to content

feat(loop): cycle C003 — anchor-as-button a11y detector + fix#459

Closed
HomenShum wants to merge 3 commits into
mainfrom
loop/c003-a11y-anchors
Closed

feat(loop): cycle C003 — anchor-as-button a11y detector + fix#459
HomenShum wants to merge 3 commits into
mainfrom
loop/c003-a11y-anchors

Conversation

@HomenShum

Copy link
Copy Markdown
Owner

Self-improvement loop cycle C003 (stacked on #458). Adds detectAnchorButtons and fixes 3 real 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 use chore/loop-* branch names. 🤖 Generated with Claude Code

HShuM and others added 3 commits June 1, 2026 23:41
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>
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nodebench-ai Ignored Ignored Preview Jun 2, 2026 6:58am

Request Review

@HomenShum HomenShum enabled auto-merge (squash) June 2, 2026 06:56
@HomenShum

Copy link
Copy Markdown
Owner Author

Superseded by a clean rebuild on updated main (stacked-PR conflict after #458 squash-merged). Reopened as a fresh chore/loop-c003-a11y branch.

@HomenShum HomenShum closed this Jun 2, 2026
auto-merge was automatically disabled June 2, 2026 06:59

Pull request was closed

@HomenShum HomenShum deleted the loop/c003-a11y-anchors branch June 2, 2026 06:59
@augmentcode

augmentcode Bot commented Jun 2, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Expands the self-improvement scanner with additional deterministic a11y/security detectors and fixes several “anchors used as buttons” in the ScratchNode proto surface.

Changes:

  • Updated loop workflow guidance to use chore/loop-* (Conventional prefix) branch names.
  • Added comment-masking and new detectors in scripts/improvement-loop/scan.mjs, including detectAnchorButtons.
  • Added form-aware detection for missing button type, plus detectors for target="_blank" missing rel="noopener" and <img> missing alt.
  • Fixed 3 anchors-as-buttons in public/proto/home-v5.html by adding role="button" + tabindex="0".
  • Added a global Enter/Space keydown delegate to activate a[role=button] via keyboard.
  • Recorded Cycle C002/C003 outcomes in the changelogs and improvement-loop ledger.json.

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 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread public/proto/home-v5.html
} 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>

@augmentcode augmentcode Bot Jun 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Fix This in Augment

🤖 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;

@augmentcode augmentcode Bot Jun 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:228
  • scripts/improvement-loop/scan.mjs:229
  • scripts/improvement-loop/scan.mjs:230

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants