Skip to content

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.

feat(editor): global keyboard focus ring

yhhb4a43789f4fe
diff --git a/desktop/src/theme/global.css b/desktop/src/theme/global.css
index d3e3ee0d8..9f7611f1b 100644
--- a/desktop/src/theme/global.css
+++ b/desktop/src/theme/global.css
@@ -44,6 +44,16 @@ button {
cursor: pointer;
}
+/* — Keyboard focus: one shared ring on every focusable control that isn't a
+ text field (fields show focus on their own border). :focus-visible only
+ matches keyboard/assistive focus, so mouse interaction stays quiet.
+ :where() keeps specificity at the bare pseudo-class, so any surface can
+ override with a single class selector. — */
+:where(button, [role='button'], [role='menuitem'], [role='tab'], [role='switch'], [role='option'], [tabindex]):focus-visible {
+ outline: 1px solid var(--star-line);
+ outline-offset: -1px;
+}
+
::selection {
background: var(--star-dim);
}
diff --git a/desktop/src/theme/outliner.css b/desktop/src/theme/outliner.css
index 62cbd3657..b5446d611 100644
--- a/desktop/src/theme/outliner.css
+++ b/desktop/src/theme/outliner.css
@@ -72,7 +72,9 @@
.row.cursor:not(.sel) { background: var(--srf-4); box-shadow: inset 0 0 0 1px var(--acc); }
.row.cursor:not(.sel) .ricon { color: var(--acc); }
.row.folder.cursor:not(.sel) .ricon { color: var(--acc); }
-.pbody:focus, .pbody:focus-visible { outline: none; }
+/* Mouse focus stays quiet (the cursor row is the indicator); keyboard focus
+ gets the shared global :focus-visible ring. */
+.pbody:focus { outline: none; }
.row .twist { width: 16px; height: 100%; display: grid; place-items: center; color: var(--text-mute); flex-shrink: 0; }
.row.sel .twist { color: rgba(255, 255, 255, 0.8); }
.row .twist svg { transition: transform var(--t-fast) var(--e-out); }