Skip to content

feat(loop): cycles C003+C004 — anchor + input a11y detectors & fixes#461

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

feat(loop): cycles C003+C004 — anchor + input a11y detectors & fixes#461
HomenShum wants to merge 3 commits into
mainfrom
chore/loop-c003-a11y

Conversation

@HomenShum
Copy link
Copy Markdown
Owner

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

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>
@HomenShum HomenShum enabled auto-merge (squash) June 2, 2026 07:00
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

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

Project Deployment Actions Updated (UTC)
nodebench-ai Ready Ready Preview, Comment Jun 2, 2026 7:41am

Request Review

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Jun 2, 2026

🤖 Augment PR Summary

Summary: Improves ScratchNode proto home a11y by treating certain anchors as real buttons and extending the self-improvement loop scanner.

Changes:

  • Added detectAnchorButtons to the improvement-loop scanner to flag <a onclick> elements missing href/role.
  • Updated three anchors (Open wiki / Take the tour / Republish) to use role="button" + tabindex="0".
  • Added a global Enter/Space keydown delegate to activate a[role="button"] via keyboard.
  • Recorded cycle C003 in the loop ledger and appended changelog entries.
  • Adjusted the loop rule to use a CI-compatible branch naming pattern.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

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

let m;
while ((m = re.exec(text))) {
const a = m[1];
if (!/\bonclick\s*=/.test(a)) continue;
Copy link
Copy Markdown

@augmentcode augmentcode Bot Jun 2, 2026

Choose a reason for hiding this comment

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

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

Fix This in Augment

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

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>
Copy link
Copy Markdown

@augmentcode augmentcode Bot Jun 2, 2026

Choose a reason for hiding this comment

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

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

Fix This in Augment

🤖 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/...`.
Copy link
Copy Markdown

@augmentcode augmentcode Bot Jun 2, 2026

Choose a reason for hiding this comment

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

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

Fix This in Augment

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

HShuM and others added 2 commits June 2, 2026 00:38
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>
@HomenShum HomenShum changed the title feat(loop): cycle C003 — anchor-as-button a11y detector + fix feat(loop): cycles C003+C004 — anchor + input a11y detectors & fixes Jun 2, 2026
@HomenShum HomenShum closed this Jun 3, 2026
auto-merge was automatically disabled June 3, 2026 22:32

Pull request was closed

@HomenShum HomenShum deleted the chore/loop-c003-a11y branch June 3, 2026 22:32
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