Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(create-agent): finish the keyboard handler left mid-edit in this worktree

nirholas33ca4638a647
diff --git a/src/create-agent.js b/src/create-agent.js
index 1d291fdab..f43f2cb93 100644
--- a/src/create-agent.js
+++ b/src/create-agent.js
@@ -1130,6 +1130,9 @@ function wireModel() {
const on = t === tab;
t.classList.toggle('is-active', on);
t.setAttribute('aria-selected', on ? 'true' : 'false');
+ // Roving tabindex: a tablist is one tab stop, and the arrow keys
+ // move within it (wired below).
+ t.tabIndex = on ? 0 : -1;
});
document
.querySelectorAll('.model-pane')
@@ -1158,6 +1161,25 @@ function wireModel() {
});
});
+ // Arrow-key navigation across the tablist, per the WAI-ARIA tabs pattern.
+ // Without it the roving tabindex above would trap a keyboard user on
+ // whichever tab is selected, with no way to reach the other three.
+ const modelTabs = Array.from(document.querySelectorAll('.model-tab'));
+ modelTabs.forEach((tab, idx) => {
+ tab.addEventListener('keydown', (e) => {
+ const last = modelTabs.length - 1;
+ let target;
+ if (e.key === 'ArrowRight') target = modelTabs[idx === last ? 0 : idx + 1];
+ else if (e.key === 'ArrowLeft') target = modelTabs[idx === 0 ? last : idx - 1];
+ else if (e.key === 'Home') target = modelTabs[0];
+ else if (e.key === 'End') target = modelTabs[last];
+ else return;
+ e.preventDefault();
+ target.focus();
+ target.click();
+ });
+ });
+
// "Add later" acknowledgment — required to advance without an avatar.
$('f-skip-ack')?.addEventListener('change', (e) => {
state.model.skipAck = e.target.checked;