A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): Outliner interaction + ARIA consistency
yhhd74d0567a01f
diff --git a/desktop/src/components/VirtualTree.tsx b/desktop/src/components/VirtualTree.tsxindex 80c6c1b1b..7605abd33 100644--- a/desktop/src/components/VirtualTree.tsx+++ b/desktop/src/components/VirtualTree.tsx@@ -84,7 +84,9 @@ export function VirtualTree<T>({onScroll?.(e);}}>- <div style={{ height: total * rowHeight, position: 'relative' }}>+ {/* Virtualization sizer — presentational so it doesn't sit between a+ role="tree" container and its role="treeitem" rows. */}+ <div role="presentation" style={{ height: total * rowHeight, position: 'relative' }}>{items.slice(start, end).map((item, i) => {const index = start + i;return (diff --git a/desktop/src/i18n/messages/outliner.ts b/desktop/src/i18n/messages/outliner.tsindex e4d4d940e..b2aaf0df0 100644--- a/desktop/src/i18n/messages/outliner.ts+++ b/desktop/src/i18n/messages/outliner.ts@@ -30,6 +30,7 @@ export const outlinerMessages = defineMessages({'out.colLock': { en: 'lock', zh: '锁定' },'out.colVis': { en: 'vis', zh: '可见性' },+ 'out.tree': { en: 'Scene hierarchy', zh: '场景层级' },// — Empty states —'out.emptyScene': { en: 'No entities in scene.', zh: '场景中没有实体。' },'out.waitingEngine': { en: 'Waiting for engine…', zh: '正在等待引擎…' },diff --git a/desktop/src/outliner/OutlinerRow.tsx b/desktop/src/outliner/OutlinerRow.tsxindex bc7e81f30..50d882b22 100644--- a/desktop/src/outliner/OutlinerRow.tsx+++ b/desktop/src/outliner/OutlinerRow.tsx@@ -98,6 +98,10 @@ function OutlinerRowInner(props: OutlinerRowProps) {`${dropPos === 'after' ? ' drop-after' : ''}`}style={{ paddingLeft: depth * 14 }}+ role="treeitem"+ aria-selected={selected}+ aria-expanded={hasChildren ? expanded : undefined}+ aria-level={depth + 1}draggable={props.draggable && !renaming}onClick={(e) => props.onClick(item, e)}onContextMenu={props.onContextMenu ? (e) => props.onContextMenu!(e, item) : undefined}diff --git a/desktop/src/panels/Outliner.tsx b/desktop/src/panels/Outliner.tsxindex 3ce3ae58a..8d0168883 100644--- a/desktop/src/panels/Outliner.tsx+++ b/desktop/src/panels/Outliner.tsx@@ -303,6 +303,15 @@ export function Outliner() {}break;}+ case 'Escape': {+ // Clear a folder selection here — the global entity.deselect command is+ // gated on an ENTITY selection, so it never reaches a folder-only one.+ if (useOutliner.getState().selectedFolder != null) {+ e.stopPropagation();+ useOutliner.getState().selectFolder(null);+ }+ break;+ }default: {if (e.key.length !== 1 || e.key === ' ' || e.ctrlKey || e.metaKey || e.altKey) break;// The focused tree owns printable keys (jump-to-name), like the arrows —@@ -320,9 +329,10 @@ export function Outliner() {if (item.kind === 'folder') {// Selecting a folder is mutually exclusive with the entity selection: the// folder gets the blue selection, entities clear, Details shows the folder.+ // Expand/collapse is the twist's job (like the entity rows and the Content+ // Browser tree) — clicking the row shouldn't also toggle it.useOutliner.getState().selectFolder(item.path);useSelection.getState().select(null);- toggleExpanded(item.key);return;}useOutliner.getState().selectFolder(null); // an entity selection clears the folder one@@ -744,6 +754,9 @@ export function Outliner() {<VirtualTreeclassName="pbody"tabIndex={0}+ role="tree"+ aria-label={t('out.tree')}+ aria-multiselectableitems={items}rowHeight={ROW_H}getKey={(it) => it.key}