diff --git a/.changeset/37556-phone-dock-closes-on-citation.md b/.changeset/37556-phone-dock-closes-on-citation.md new file mode 100644 index 00000000000..d80988a2521 --- /dev/null +++ b/.changeset/37556-phone-dock-closes-on-citation.md @@ -0,0 +1,10 @@ +--- +'@object-ui/app-shell': patch +--- + +fix(console): on a phone, a page the AI assistant opens closes the assistant sheet so the page shows + +Clause-②: no +Metadata-protocol: none + +On a phone the assistant is a bottom sheet over the page. Clicking a citation chip in an answer opened the cited record section underneath, but the sheet stayed open over it, so the marked heading was hidden and the click looked like it did nothing. Now a navigation the assistant makes on a phone (a citation chip, a record or list link, opening a form) closes the sheet, including a second click on the same chip. The conversation is kept: reopening the assistant shows the same thread. On a desktop the assistant is a panel beside the page and stays open, as before. diff --git a/ui/packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx b/ui/packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx new file mode 100644 index 00000000000..3bc79b4a165 --- /dev/null +++ b/ui/packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx @@ -0,0 +1,167 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37556 — on a phone the assistant drawer is a bottom sheet over + * the page. A citation chip in it navigates to the cited record section, and + * the sheet must get out of the way so the marked heading is visible; on a + * desktop the drawer is a rail beside the page and stays open. + * + * ## Real subjects + * + * The real `useConsoleChatDock` host, the real `useChatDockState`, the real + * router. The sheet and the rail are stand-ins that show whether the host + * mounts them open: which chrome is open is the subject, not the chat inside. + * The chip is a stand-in that navigates the way the chat's record-citation + * door does (a PUSH to the record route with fresh router state). + */ + +import '@testing-library/jest-dom/vitest'; +import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'; +import React from 'react'; +import { render, screen, fireEvent, cleanup, act } from '@testing-library/react'; +import { MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom'; + +let mobile = true; +vi.mock('@object-ui/components', async (importOriginal) => ({ + ...(await importOriginal>()), + useIsMobile: () => mobile, +})); + +vi.mock('../ChatDock', async (importOriginal) => ({ + ...(await importOriginal>()), + ChatDockPanel: () =>