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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(scene-studio): name the animation controls for assistive tech and rework the empty state
nirholas5fb4e14c2dd2
diff --git a/src/scene-studio/README.md b/src/scene-studio/README.mdindex c4d239998..50e874ed1 100644--- a/src/scene-studio/README.md+++ b/src/scene-studio/README.md@@ -20,9 +20,10 @@ upstream demo: models forged on `/forge` or `/forge-max` deep-link straight intothe scene, animations baked on `/pose` hand off through IndexedDB, and anycomposed scene can be exported with one click or uploaded and embedded onanother site. They also close the gaps the upstream demo never had to care-about: a first-run empty state, accessible names on the icon-only transform-buttons, and failures that surface in the platform's own toast instead of a-native `alert()`.+about: a first-run empty state, accessible names on the icon-only transform and+animation-transport buttons, a sidebar that fits a 320px screen instead of+overflowing it, and failures that surface in the platform's own toast instead of+a native `alert()`.## Layout@@ -34,7 +35,8 @@ src/scene-studio/│ adds a parsed GLB through the undo-able AddObjectCommand path├── actions.js Layered action bar: Import from Forge, Export presets, Share├── empty-state.js First-run overlay over the empty grid, retires on first object-├── toolbar-a11y.js Accessible names + pressed state for the transform gizmo buttons+├── toolbar-a11y.js Accessible names for the icon-only controls: the transform+│ gizmos (plus pressed state) and the animation transport├── studio.css three.ws chrome overrides (vendor css/main.css is untouched)└── vendor/ three.js r184 editor source (see vendor/README.md)```@@ -100,7 +102,7 @@ affordances the stock File and Export menus do not offer on their own:## Exports-The wrappers export two functions; `main.js` is entry-only and exports nothing.+The wrappers export seven functions; `main.js` is entry-only and exports nothing.| Module | Export | What it does || --- | --- | --- |@@ -111,6 +113,7 @@ The wrappers export two functions; `main.js` is entry-only and exports nothing.| `actions.js` | `describeImportFailure(error)` | Turns an `HTTP 4xx` / `Failed to fetch` into copy that names the likely cause. || `empty-state.js` | `mountEmptyState(editor, container)` | Mounts the first-run overlay and keeps it in sync with the scene graph. Returns the overlay element. || `toolbar-a11y.js` | `enhanceToolbarA11y(editor, toolbarDom)` | Labels the vendored translate/rotate/scale buttons and mirrors their `selected` class into `aria-pressed`. Returns the labelled buttons. |+| `toolbar-a11y.js` | `enhanceAnimationA11y(editor, animationDom)` | Labels the vendored animation timeline's play/pause/stop transport, which ships as three identical unnamed icon buttons. Matches each one on the SVG shape the vendor draws, not on child order, so a control added to that panel can never inherit the wrong label. Returns the labelled buttons. |## Examplediff --git a/src/scene-studio/empty-state.js b/src/scene-studio/empty-state.jsindex 34a904e88..8c348ae9c 100644--- a/src/scene-studio/empty-state.js+++ b/src/scene-studio/empty-state.js@@ -134,10 +134,34 @@ const CSS = `.tws-se-btn { transition: none; }}/* Below 600px the vendored sidebar docks along the bottom instead of the right- (vendor/css/main.css), so the overlay spans the full width and stops above it. */+ (vendor/css/main.css), so the overlay spans the full width and stops above it.+ Two narrow-viewport corrections on top of that:++ 1. The card was centred in a region starting at the menubar (top: 36px), which+ put it straight under the quick-action bar (actions.js pins that at+ top: 44px). At 320px the two boxes genuinely overlapped and the bar sat on+ top of the card's eyebrow and title. Starting the region below the bar+ instead of centring through it keeps both readable.+ 2. A phone-height viewport leaves this region shorter than the card: at+ 320x568 the vendored layout gives the 3D view 143px and a 320px sidebar+ dock. Capping the card at the region height and letting it scroll inside+ itself means it never spills over the sidebar underneath. The card already+ re-enables pointer events, so that scroll works by touch and wheel while+ the rest of the overlay stays click-through for orbiting. */@media (max-width: 600px) {- .tws-se { right: 0; bottom: 320px; }- .tws-se-card { padding: 18px; }+ .tws-se {+ right: 0;+ top: 76px;+ bottom: 320px;+ align-items: flex-start;+ padding: 0 12px 12px;+ }+ .tws-se-card {+ max-height: 100%;+ overflow-y: auto;+ overscroll-behavior: contain;+ padding: 16px;+ }.tws-se-title { font-size: 17px; }}`;diff --git a/src/scene-studio/main.js b/src/scene-studio/main.jsindex 28b873640..52d0864b8 100644--- a/src/scene-studio/main.js+++ b/src/scene-studio/main.js@@ -30,7 +30,7 @@ import { TextGeometry } from 'three/addons/geometries/TextGeometry.js';import { addGltfBufferToScene as sharedAddGltfBufferToScene } from './loader.js';import { mountStudioActions } from './actions.js';import { mountEmptyState } from './empty-state.js';-import { enhanceToolbarA11y } from './toolbar-a11y.js';+import { enhanceAnimationA11y, enhanceToolbarA11y } from './toolbar-a11y.js';import { toastError } from '../shared/toast.js';window.URL = window.URL || window.webkitURL;@@ -77,8 +77,10 @@ container.appendChild(animationResizer.dom);mountStudioActions(editor, container);// The vendored transform buttons ship as icon-only <button>s with no-// accessible name; label them and announce their pressed state.+// accessible name; label them and announce their pressed state. The animation+// timeline's play/pause/stop transport has the same gap.enhanceToolbarA11y(editor, toolbar.dom);+enhanceAnimationA11y(editor, animation.dom);// First-run guidance over the empty grid. Retires itself as soon as the scene// holds anything, including a scene restored from the autosave below.diff --git a/src/scene-studio/studio.css b/src/scene-studio/studio.cssindex 86d0c5669..064308692 100644--- a/src/scene-studio/studio.css+++ b/src/scene-studio/studio.css@@ -56,6 +56,22 @@ body.scene-studio {#studio-app #menubar .menu .title {padding: 10px 6px;}++ /* Below 600px the vendored sidebar stops being a right-hand column and docks+ * full-width along the bottom, but it is also the .TabbedPanel, which carries+ * `min-width: 335px` from vendor/css/main.css. 335 is wider than a 320px+ * viewport, so the dock overflowed the screen by 15px and body's+ * `overflow: hidden` cut that strip off: the outliner's type labels, the right+ * stepper of every number field, and the right edge of every row in the+ * OBJECT/GEOMETRY/MATERIAL panels were unreachable at 320px.+ *+ * The min-width exists to stop the desktop resizer (vendor/js/Resizer.js+ * clamps its drag to the same 335) from collapsing the column. A full-width+ * bottom dock has no resizer (the same media query hides #resizer), so there+ * is nothing left for the floor to protect. */+ #studio-app #sidebar {+ min-width: 0;+ }}#studio-app #menubar .menu:hover,diff --git a/src/scene-studio/toolbar-a11y.js b/src/scene-studio/toolbar-a11y.jsindex 2a19ed0ad..5e18605ef 100644--- a/src/scene-studio/toolbar-a11y.js+++ b/src/scene-studio/toolbar-a11y.js@@ -1,4 +1,4 @@-// Scene Studio: accessible names for the vendored transform toolbar.+// Scene Studio: accessible names for the vendored icon-only controls.//// The vendored Toolbar (vendor/js/Toolbar.js) builds its translate / rotate /// scale controls as a <button> whose only child is an <img> carrying a `title`@@ -6,10 +6,14 @@// that wraps it, so all three shipped to screen readers as unlabelled buttons,// and the pressed state (a `selected` class) was never announced at all.//-// This runs over the mounted toolbar once and fixes both, reading the labels-// from the same `editor.strings` table the vendor uses for the tooltips, so a-// translated UI stays translated. Sibling module: it edits the live DOM, never-// vendor/**.+// The animation timeline (vendor/js/Animation.js) has the same problem one step+// worse: its play / pause / stop transport is three 24px <button>s whose only+// child is an inline <svg> with no title at all, so they reached a screen reader+// as three identical unnamed buttons with nothing to tell them apart.+//+// Both fixes run over the mounted DOM once, reading labels from the same+// `editor.strings` table the vendor uses for its own copy, so a translated UI+// stays translated. Sibling module: it edits the live DOM, never vendor/**.const MODE_KEYS = ['translate', 'rotate', 'scale'];@@ -54,3 +58,45 @@ export function enhanceToolbarA11y(editor, toolbarDom) {return buttons.map(({ button }) => button);}++// The vendored transport icons, keyed by the SVG geometry Animation.js draws.+// Matched on the shape rather than on child order, for the same reason the+// toolbar above matches on the icon file: a control added to the vendored panel+// must never be able to silently inherit one of these labels. A re-vendor that+// redraws an icon leaves that one button unlabelled (what it is today) instead+// of mislabelled, which is the safer way to fail.+const TRANSPORT = [+ { selector: 'path[d="M3 1.5v9l7-4.5z"]', stringKey: 'sidebar/animations/play', fallback: 'Play' },+ // Upstream ships no `sidebar/animations/pause` key (the sidebar it was+ // written for has no pause control), so this one label stays English until+ // the vendored table grows one.+ { selector: 'path[d="M2 1h3v10H2zM7 1h3v10H7z"]', stringKey: null, fallback: 'Pause' },+ { selector: 'rect[x="2"][y="2"]', stringKey: 'sidebar/animations/stop', fallback: 'Stop' },+];++/**+ * Label the animation timeline's play / pause / stop buttons.+ * @param {import('./vendor/js/Editor.js').Editor} editor+ * @param {HTMLElement} animationDom the Animation instance's `.dom`.+ * @returns {HTMLButtonElement[]} the buttons that were labelled.+ */+export function enhanceAnimationA11y(editor, animationDom) {+ const labelled = [];++ for (const { selector, stringKey, fallback } of TRANSPORT) {+ const button = animationDom.querySelector(selector)?.closest('button');+ if (!button) continue;++ // Strings.getKey answers '???' for a key the active language lacks, which+ // would be a worse accessible name than the English word.+ const translated = stringKey ? editor.strings.getKey(stringKey) : null;+ const label = translated && translated !== '???' ? translated : fallback;++ button.setAttribute('type', 'button');+ button.setAttribute('aria-label', label);+ if (!button.title) button.title = label;+ labelled.push(button);+ }++ return labelled;+}