Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ui): drop the dead wiki :has() rule that restyled the whole app every frame

rubenluetke10-beep5c9c75163b4e
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index b83628a33c..bee7361903 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -1206,17 +1206,6 @@ body {
}
@layer utilities {
- /* A transparent full-screen map must not reveal the app bar's labels under
- its own toolbar. The shell controls stay hidden while the map is expanded
- and return immediately when it restores. */
- main:has(
- > .jarvis-section-stage
- #wiki-workspace[data-graph-expanded="true"]
- )
- > :not(.jarvis-section-stage) {
- visibility: hidden;
- }
-
/* Staggered reveal on view mount — one orchestrated page-load moment.
Pair with an inline `animationDelay` for the stagger cadence. */
@keyframes profile-rise {
diff --git a/jarvis/ui/web/frontend/src/styles/has-selector-scope.test.ts b/jarvis/ui/web/frontend/src/styles/has-selector-scope.test.ts
new file mode 100644
index 0000000000..a307207898
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/styles/has-selector-scope.test.ts
@@ -0,0 +1,29 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, it } from "vitest";
+
+/**
+ * No `:has()` rule may watch a whole shell region for a deep descendant.
+ *
+ * `main:has(> .stage #some-node)` looks harmless, but the engine has to
+ * re-check it after EVERY DOM change anywhere inside <main> — which is the
+ * whole app. A scrolling code editor rewrites its lines each frame, and that
+ * one dead wiki rule turned every frame into a full-app style pass: about
+ * 200 ms instead of 3 ms, so scrolling a diff ran at a few frames a second.
+ *
+ * Toggle a class or data attribute from the component instead. A `:has()`
+ * limited to a small component (`.chip:has(> br:only-child)`) stays allowed.
+ */
+
+const SOURCE_ROOT = join(process.cwd(), "src");
+
+/** A `:has()` on a shell-level element: html, body, main, or the section stage. */
+const SHELL_HAS = /(?:^|[\s,{}>])(?:html|body|main|#root|\.jarvis-(?:section|visualization)-stage|\.jarvis-sheet)\s*:has\(/m;
+
+describe("global :has() selectors", () => {
+ it("never key a shell-level element on its descendants", () => {
+ const css = readFileSync(join(SOURCE_ROOT, "index.css"), "utf8");
+ const match = css.match(SHELL_HAS);
+ expect(match?.[0] ?? null).toBeNull();
+ });
+});