From 2fa3b43d1d84761b51c79404aa5d7ff102fd939c Mon Sep 17 00:00:00 2001
From: Badcuban <108198679+badcuban@users.noreply.github.com>
Date: Mon, 26 Oct 2026 00:24:39 -0400
Subject: [PATCH] fix(web): notices on Settings pages start below the page
title and its buttons
Notices land in the top-right corner, which on Settings is where each page
keeps its buttons: Providers' Check again, Open setup and +, Keybindings,
Agent Instructions, Diagnostics, the Plugins & Skills search box, and the
phone's close button. Adding an account dropped its notice on the + just
clicked.
A page now marks the block notices must stay below (`useNoticeClearanceRef`).
It publishes that block's bottom edge, measured as if the page were scrolled
to the top, and the notice stack starts below the lowest marked block,
sliding there. SettingsPageHeader marks itself (which also covers the
Scheduled page), Plugins & Skills marks its tabs and search, and the phone
Settings header marks itself. Leaving the page clears it.
---
.../settings/ExtensionsSettings.tsx | 85 ++++++++++---------
.../components/settings/settingsLayout.tsx | 6 +-
apps/web/src/components/ui/noticeLayer.tsx | 59 ++++++++++++-
apps/web/src/components/ui/toast.browser.tsx | 48 +++++++++++
apps/web/src/components/ui/toast.tsx | 6 +-
apps/web/src/routes/settings.tsx | 4 +
6 files changed, 165 insertions(+), 43 deletions(-)
diff --git a/apps/web/src/components/settings/ExtensionsSettings.tsx b/apps/web/src/components/settings/ExtensionsSettings.tsx
index 59fe43647..02f5cffc7 100644
--- a/apps/web/src/components/settings/ExtensionsSettings.tsx
+++ b/apps/web/src/components/settings/ExtensionsSettings.tsx
@@ -126,6 +126,7 @@ import {
import { providerMcpLoginCommand, type ExtensionMcpLoginProvider } from "../../mcpAuthStatus";
import { Badge } from "../ui/badge";
import { Button } from "../ui/button";
+import { useNoticeClearanceRef } from "../ui/noticeLayer";
import { PageTabButton } from "../ui/page-tabs";
import {
Dialog,
@@ -4453,6 +4454,7 @@ function ExtensionScopePicker({
}
export function ExtensionsSettingsPanel() {
+ const noticeClearanceRef = useNoticeClearanceRef();
const projects = useStore(useShallow(selectWorkspaceProjectsAcrossEnvironments));
const threads = useStore(useShallow(selectThreadsAcrossEnvironments));
const sidebarThreads = useStore(useShallow(selectSidebarThreadsAcrossEnvironments));
@@ -5457,46 +5459,53 @@ export function ExtensionsSettingsPanel() {
) : null}
-
-
-
selectTab("plugins")}
- />
- selectTab("skills")}
- />
-
-
- {isLoading ? (
-
-
- Loading
-
- ) : inventory?.generatedAt ? (
- `Loaded ${new Date(inventory.generatedAt).toLocaleTimeString()}${
- lastInventoryLoadMs !== null ? ` in ${formatDuration(lastInventoryLoadMs)}` : ""
- }`
- ) : null}
+ {/* Tabs and search sit where notices land; notices start below them. */}
+
+
+
+
selectTab("plugins")}
+ />
+ selectTab("skills")}
+ />
+
+
+ {isLoading ? (
+
+
+ Loading
+
+ ) : inventory?.generatedAt ? (
+ `Loaded ${new Date(inventory.generatedAt).toLocaleTimeString()}${
+ lastInventoryLoadMs !== null ? ` in ${formatDuration(lastInventoryLoadMs)}` : ""
+ }`
+ ) : null}
+
+ {scope !== null && !scopeIsReachable ? (
+
{scopeMachineLabel} is not connected.
+ ) : null}
+
setPageQuery(event.currentTarget.value)}
+ />
- {scope !== null && !scopeIsReachable ? (
-
{scopeMachineLabel} is not connected.
- ) : null}
-
setPageQuery(event.currentTarget.value)}
- />
+
{resolvedTitle || actions ? (
// Below `md` the title is hidden, so the line exists only for actions.
diff --git a/apps/web/src/components/ui/noticeLayer.tsx b/apps/web/src/components/ui/noticeLayer.tsx
index bea86def0..abcadf593 100644
--- a/apps/web/src/components/ui/noticeLayer.tsx
+++ b/apps/web/src/components/ui/noticeLayer.tsx
@@ -1,4 +1,10 @@
-import { useEffect, useSyncExternalStore, type ComponentPropsWithRef } from "react";
+import {
+ useCallback,
+ useEffect,
+ useSyncExternalStore,
+ type ComponentPropsWithRef,
+ type RefCallback,
+} from "react";
/**
* Notices sit below the app's overlay layer so a menu that opens into their
@@ -48,3 +54,54 @@ export function CoveringBackdrop({
}, [open]);
return
;
}
+
+/** How far down the page notices start, in viewport px; 0px leaves them at their usual spot. */
+export const NOTICE_TOP_CLEARANCE_CSS_VAR = "--notice-top-clearance";
+
+/** Bottom edge of each element notices stay below; the lowest one wins. */
+const clearanceBottoms = new Map
();
+
+function publishNoticeClearance() {
+ const bottom = Math.max(0, ...clearanceBottoms.values());
+ document.documentElement.style.setProperty(
+ NOTICE_TOP_CLEARANCE_CSS_VAR,
+ `${Math.round(bottom)}px`,
+ );
+}
+
+function closestScroller(node: HTMLElement): HTMLElement | null {
+ for (let parent = node.parentElement; parent; parent = parent.parentElement) {
+ if (/(auto|scroll)/.test(getComputedStyle(parent).overflowY)) return parent;
+ }
+ return null;
+}
+
+/**
+ * Keeps notices below the element this ref is on: a page's title row and the
+ * buttons beside it, which sit in the corner notices land in (Settings pages,
+ * the phone's Settings header). Measures the element's bottom edge as it sits
+ * with its page scrolled to the top, so notices stay put while the page
+ * scrolls; with several on screen, notices clear the lowest. Put it on the
+ * whole block, so anything that grows inside it moves the line too.
+ */
+export function useNoticeClearanceRef(): RefCallback {
+ return useCallback((node: HTMLElement | null) => {
+ if (!node || typeof ResizeObserver === "undefined") return undefined;
+ const scroller = closestScroller(node);
+ const measure = () => {
+ // A hidden element (the phone header on a wide window) measures 0.
+ clearanceBottoms.set(node, node.getBoundingClientRect().bottom + (scroller?.scrollTop ?? 0));
+ publishNoticeClearance();
+ };
+ const observer = new ResizeObserver(measure);
+ observer.observe(node);
+ window.addEventListener("resize", measure);
+ measure();
+ return () => {
+ observer.disconnect();
+ window.removeEventListener("resize", measure);
+ clearanceBottoms.delete(node);
+ publishNoticeClearance();
+ };
+ }, []);
+}
diff --git a/apps/web/src/components/ui/toast.browser.tsx b/apps/web/src/components/ui/toast.browser.tsx
index 11a461bb2..4cd3ec5ae 100644
--- a/apps/web/src/components/ui/toast.browser.tsx
+++ b/apps/web/src/components/ui/toast.browser.tsx
@@ -13,6 +13,7 @@ vi.mock("@tanstack/react-router", async (importOriginal) => ({
}));
import { Dialog, DialogPopup, DialogTitle } from "./dialog";
+import { useNoticeClearanceRef } from "./noticeLayer";
import { ToastProvider, stackedThreadToast, toastManager } from "./toast";
/**
@@ -130,6 +131,53 @@ describe("toast layering", () => {
});
});
+function PageTitleRow() {
+ return (
+
+ );
+}
+
+describe("notice placement", () => {
+ afterEach(() => {
+ toastManager.close();
+ document.body.innerHTML = "";
+ });
+
+ it("starts below a page's title row while the page is open, and goes back after", async () => {
+ const mounted = await render(
+
+
+ ,
+ );
+
+ try {
+ toastManager.add({ type: "info", title: "Removed 1 device", timeout: 0 });
+ const viewport = await vi.waitFor(() => {
+ const found = document.querySelector("[data-slot='toast-viewport']");
+ expect(found?.firstElementChild).toBeTruthy();
+ return found!;
+ });
+ const titleRowBottom = document.querySelector("header")!.getBoundingClientRect().bottom;
+ await vi.waitFor(() =>
+ expect(viewport.getBoundingClientRect().top).toBeGreaterThanOrEqual(titleRowBottom),
+ );
+
+ await mounted.rerender(
+
+ conversation
+ ,
+ );
+ await vi.waitFor(() =>
+ expect(viewport.getBoundingClientRect().top).toBeLessThan(titleRowBottom),
+ );
+ } finally {
+ await mounted.unmount();
+ }
+ });
+});
+
describe("notice reasons and clocks", () => {
afterEach(() => {
toastManager.close();
diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx
index 7063ca052..8ada8ad98 100644
--- a/apps/web/src/components/ui/toast.tsx
+++ b/apps/web/src/components/ui/toast.tsx
@@ -797,8 +797,10 @@ function Toasts({ position = "top-right" }: { position: ToastPosition }) {
// a notice raised then must not sit blurred underneath it.
raisedAboveBackdrops ? "z-60" : "z-40",
"fixed mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-[20rem] [--toast-header-offset:52px] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(6)]",
- // Vertical positioning
- "data-[position*=top]:top-[calc(var(--toast-inset)+var(--toast-header-offset))]",
+ // Vertical positioning. A page can push the stack below its own
+ // title row and buttons (`useNoticeClearanceRef`); it slides there.
+ "data-[position*=top]:top-[max(calc(var(--toast-inset)+var(--toast-header-offset)),calc(var(--notice-top-clearance,0px)+8px))]",
+ "transition-[top] duration-200 ease-out motion-reduce:transition-none",
"data-[position*=bottom]:bottom-(--toast-inset)",
// Horizontal positioning. Right-anchored toasts sit beside the open
// right panel rather than on top of it: the panel publishes its width
diff --git a/apps/web/src/routes/settings.tsx b/apps/web/src/routes/settings.tsx
index 475c62a97..9a6998d35 100644
--- a/apps/web/src/routes/settings.tsx
+++ b/apps/web/src/routes/settings.tsx
@@ -16,6 +16,7 @@ import {
settingsSectionLabelForPath,
} from "../components/settings/settingsNavigation";
import { Button } from "../components/ui/button";
+import { useNoticeClearanceRef } from "../components/ui/noticeLayer";
import { PageTitlebar } from "../components/PageTitlebar";
import { SidebarInset } from "../components/ui/sidebar";
import { isElectron } from "../env";
@@ -49,6 +50,8 @@ function SettingsContentLayout() {
const location = useLocation();
const { authGateState } = Route.useRouteContext();
const navigate = useNavigate();
+ // The phone header's close button sits where notices land.
+ const noticeClearanceRef = useNoticeClearanceRef();
const navigateBackWithinApp = useNavigateBackWithinApp();
const [restoreSignal, setRestoreSignal] = useState(0);
const isHostedStatic = authGateState.status === "hosted-static";
@@ -92,6 +95,7 @@ function SettingsContentLayout() {
{!isElectron && (