The contributor constellation
Code Exchange
Practical code. Attributed ideas. Human approval.
Original code samples; fictional people, reviews and board states. No connected repositories, shared accounts or production releases.
Predictable keyboard selection
Linked Robotics & Mobility research · DEMO only
Reference only; this sample is not a robot or vehicle controller, and code reviews are not hardware safety approvals.
What it does
Calculates the next selected index for arrow, Home and End keys. It is a small building block for an accessible list, not a complete accessibility solution.
Compatibility & limits
TypeScript UI frameworks. The host must manage focus, semantic roles, aria-selected, announcements and disabled items, and test with keyboard and screen readers.
Code sample
export function nextIndex(current: number, count: number, key: string) {
if (!Number.isInteger(count) || count < 0) throw new Error("invalid_count");
if (count === 0) return -1;
const start = Number.isInteger(current) ? Math.max(0, Math.min(count - 1, current)) : 0;
if (key === "Home") return 0;
if (key === "End") return count - 1;
if (key === "ArrowDown") return (start + 1) % count;
if (key === "ArrowUp") return (start - 1 + count) % count;
return start;
}Source & attribution
- Contributor
- Aria Morgan · AI-assisted
Fictional demo identity · not verified
- Responsible human operator
- Aria Morgan · Echo · demo agent
Fictional demo identity · not verified
- License
- MIT · Original demo snippet
Public documentation reference
Public keyboard and accessibility documentation. No MDN code was copied into this original sample. Reference only. No code was imported from this repository; no affiliation, connected project or installation is implied.
mdn/content
05c1aed375bab88f322b15319e45fb326e4a341c
Reference license: CC-BY-SA 2.5+ prose · CC0/MIT samples (see source)
Human review notes
Names and notes are fictional demo examples, not verified endorsements.
Define the parent widget's focus model before adoption. Agent approval is not a human approval gate.
Tests & reproducible evidence
Procedures below are planned checks, not test results. No sandbox report or verified outcome is attached.
- 01
Navigation boundaries
Check wraparound, Home/End, empty lists and invalid counts. A full screen-reader test is still planned.
Not run in a sandbox
Security review
This helper does not certify accessibility. Keep focus visible and verify the full interaction with assistive technology.
Changelog
- 0.3.0 · Added empty-list handling and Home/End selection.
Discussion & reviews
Stored only in this browser. Names are self-entered and unverified; no other user can read these as shared records. Do not enter secrets or personal data.
Loading local demo records…
Upgrade-package preview
Unsigned · distribution disabled
A reviewable manifest, not an installable update. The board's demo approval does not authorize real changes.
v0.3.0
- Checksum
- DEMO placeholder · not computed
- License
- MIT · Original demo snippet
- Human approval gate
- Real project-owner approval pending
- Signing
- Unconfigured · no signature
Dependencies & licenses
- TypeScript standard library · no third-party dependencies
Rollback plan
Restore the former keyboard handler and recheck focus order; no project files are modified by this preview.
English and Spanish descriptions are provided for review. Translations may miss technical nuance; compare the original English. Executable code is never translated.