Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(web): stabilize sidebar hover targets

muterCba9f2169db3a
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 3e8ab725..a7e38bdd 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -58,6 +58,11 @@ build:assets` to check the initial JS budget.
uses the red panda portrait on its warm brown tile.
- The login header uses the transparent horizontal Linger wordmark in
`public/linger-wordmark.svg`, with the proportions of `assets/logo-horizontal.svg`.
+- The compact primary rail reveals labels on hover and keyboard focus without
+ moving link hit areas or neighbouring links. A stationary pointer at an edge
+ must not trigger repeated hover enter/leave; sidebar expansion and Chat list
+ collapse remain explicit button actions. Pointer movement only resizes during
+ an active drag; keyboard resizing and double-click reset remain available.
- Gmail and Outlook message approvals show the subject and recipients once.
The subject row toggles the preview and owns its hover highlight; the
recipient line stays outside the control. The shared AutoHeight transition
diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css
index 834612cf..bb81f36c 100644
--- a/apps/web/src/app/globals.css
+++ b/apps/web/src/app/globals.css
@@ -4746,8 +4746,7 @@ button.question-choice:focus-visible {
width var(--app-emphasized-duration) var(--app-out-quint),
background-color var(--app-micro-duration) var(--app-out-quint),
color var(--app-micro-duration) var(--app-out-quint),
- box-shadow var(--app-floating-duration) var(--app-out-quint),
- transform var(--app-floating-duration) var(--app-out-quint);
+ box-shadow var(--app-floating-duration) var(--app-out-quint);
}
.primary-navigation-items .room-rail-link[aria-current="page"] {
@@ -4819,6 +4818,8 @@ button.question-choice:focus-visible {
}
@media (hover: hover) and (pointer: fine) {
+ /* Keep targets anchored: moving a hovered link or its neighbours can move
+ an edge out from under a stationary pointer and toggle hover endlessly. */
.app-navigation[data-expanded="false"] .room-rail-link:hover {
width: max-content;
padding-right: 10px;
@@ -4826,7 +4827,6 @@ button.question-choice:focus-visible {
color: hsl(var(--town-primary-foreground));
font-size: 12px;
font-weight: 400;
- transform: translateY(-2px);
box-shadow: var(--town-shadow-md);
}
.app-navigation[data-expanded="false"] .room-rail-link:hover > svg {
@@ -4839,15 +4839,6 @@ button.question-choice:focus-visible {
transform: none;
opacity: 1;
}
- .app-navigation[data-expanded="false"]
- .room-rail-link:has(~ .room-rail-link:hover) {
- transform: translateY(-4px);
- }
- .app-navigation[data-expanded="false"]
- .room-rail-link:hover
- ~ .room-rail-link {
- transform: translateY(4px);
- }
.app-navigation[data-expanded="true"]
.room-rail-link:not([aria-current="page"]):hover {
background: hsl(var(--town-sidebar-muted) / 0.6);
diff --git a/apps/web/src/features/rooms/room-navigation-hover.test.tsx b/apps/web/src/features/rooms/room-navigation-hover.test.tsx
new file mode 100644
index 00000000..1055a36d
--- /dev/null
+++ b/apps/web/src/features/rooms/room-navigation-hover.test.tsx
@@ -0,0 +1,59 @@
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
+import { afterAll, describe, expect, it } from "vitest";
+
+const navigationStyles = readFileSync(
+ resolve(import.meta.dirname, "../../app/globals.css"),
+ "utf8",
+);
+const stylesheet = document.createElement("style");
+// Only the local rules are needed; jsdom cannot load Tailwind's CSS import.
+stylesheet.textContent = navigationStyles.replace(/^@import .*;$/gm, "");
+document.head.append(stylesheet);
+
+afterAll(() => stylesheet.remove());
+
+describe("collapsed navigation hover targets", () => {
+ it.each([
+ ".room-rail-link:hover",
+ ".room-rail-link:has(~ .room-rail-link:hover)",
+ ".room-rail-link:hover ~ .room-rail-link",
+ ])("keeps the hit area stationary for %s", (selector) => {
+ // jsdom has no hit testing. Guard the CSS invariant that prevents a fixed
+ // pointer from losing hover, restoring the target, and gaining hover again.
+ const rules = styleRules(stylesheet.sheet!.cssRules).filter((rule) =>
+ rule.selectorText.replace(/\s+/g, " ").endsWith(selector),
+ );
+ for (const rule of rules) {
+ expect(rule.style.transform || "none").toBe("none");
+ expect(rule.style.getPropertyValue("translate") || "none").toBe("none");
+ }
+ });
+
+ it.each([":hover", ":focus-visible"])(
+ "still reveals the compact label on %s",
+ (state) => {
+ const selector = `.app-navigation[data-expanded="false"] .room-rail-link${state}`;
+ const rules = styleRules(stylesheet.sheet!.cssRules);
+ const link = rules.find(
+ (rule) => rule.selectorText.replace(/\s+/g, " ") === selector,
+ );
+ const label = rules.find(
+ (rule) =>
+ rule.selectorText.replace(/\s+/g, " ") ===
+ `${selector} .primary-navigation-label`,
+ );
+ expect(link?.style.width).toBe("max-content");
+ expect(label?.style.opacity).toBe("1");
+ },
+ );
+});
+
+function styleRules(rules: CSSRuleList): CSSStyleRule[] {
+ return Array.from(rules).flatMap((rule) => {
+ if (rule instanceof CSSStyleRule) return [rule];
+ if ("cssRules" in rule)
+ return styleRules((rule as CSSGroupingRule).cssRules);
+ return [];
+ });
+}