feat(webui): stabilize session transitions and goal presentation
Keep the composer stable during interruptible session changes. Move active and blocked goals into the header with localized gallery previews, and preserve focus when overlays close. Include the reviewed navigation, layout and accessibility fixes.
This commit is contained in:
1 parent
e65bec9a6e
commit
ce3f36983d
58 files changed
+1874
-453
No files matched your search
@@ -1697,87 +1697,6 @@ describe("ThreadComposer", () => {
|
||||
});
|
||||
|
||||
|
||||
it("closes the sustained goal through its existing drawer", () => {
|
||||
const { container, rerender } = render(
|
||||
<ThreadComposer
|
||||
onSend={vi.fn()}
|
||||
placeholder="Type your message..."
|
||||
goalState={{
|
||||
active: true,
|
||||
objective: "Ship the release",
|
||||
ui_summary: "Preparing release",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
const drawer = container.querySelector("[data-composer-status-drawer]");
|
||||
expect(drawer).not.toBeNull();
|
||||
expect(drawer).toHaveAttribute("data-state", "open");
|
||||
expect(drawer).not.toHaveAttribute("aria-hidden");
|
||||
const status = screen.getByRole("status");
|
||||
expect(status).toHaveClass("composer-status-drawer-content");
|
||||
|
||||
rerender(
|
||||
<ThreadComposer
|
||||
onSend={vi.fn()}
|
||||
placeholder="Type your message..."
|
||||
goalState={{ active: false }}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(container.querySelector("[data-composer-status-drawer]")).toBe(drawer);
|
||||
expect(drawer).toHaveAttribute("data-state", "closed");
|
||||
expect(drawer).toHaveAttribute("aria-hidden", "true");
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
expect(drawer?.querySelector('[role="status"]')).toBe(status);
|
||||
|
||||
fireEvent.transitionEnd(drawer as Element, { propertyName: "grid-template-rows" });
|
||||
expect(container.querySelector("[data-composer-status-drawer]")).toBeNull();
|
||||
});
|
||||
|
||||
it("shows full goal content and dismisses it without losing the composer draft", async () => {
|
||||
const user = userEvent.setup();
|
||||
const longObjective =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789GoalTail";
|
||||
render(
|
||||
<ThreadComposer
|
||||
onSend={vi.fn()}
|
||||
persistDraft={false}
|
||||
placeholder="Type your message..."
|
||||
goalState={{
|
||||
active: true,
|
||||
objective: longObjective,
|
||||
ui_summary: "Short summary for strip",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
const input = screen.getByRole("textbox", { name: "Message input" });
|
||||
const trigger = screen.getByRole("button", { name: "Show full goal" });
|
||||
await user.type(input, "Keep my draft");
|
||||
await user.click(trigger);
|
||||
|
||||
const dialog = await screen.findByRole("dialog", { name: "Goal" });
|
||||
expect(dialog).toHaveTextContent("Short summary for strip");
|
||||
expect(dialog).toHaveTextContent(longObjective);
|
||||
expect(trigger).toHaveAttribute("aria-expanded", "true");
|
||||
|
||||
await user.click(trigger);
|
||||
expect(screen.queryByRole("dialog", { name: "Goal" })).not.toBeInTheDocument();
|
||||
expect(trigger).toHaveAttribute("aria-expanded", "false");
|
||||
|
||||
await user.click(trigger);
|
||||
expect(await screen.findByRole("dialog", { name: "Goal" })).toBeVisible();
|
||||
await user.keyboard("{Escape}");
|
||||
expect(screen.queryByRole("dialog", { name: "Goal" })).not.toBeInTheDocument();
|
||||
|
||||
await user.click(trigger);
|
||||
expect(await screen.findByRole("dialog", { name: "Goal" })).toBeVisible();
|
||||
await user.click(input);
|
||||
expect(screen.queryByRole("dialog", { name: "Goal" })).not.toBeInTheDocument();
|
||||
expect(input).toHaveValue("Keep my draft");
|
||||
});
|
||||
|
||||
it("opens a slash command palette and inserts the selected command", () => {
|
||||
const onSend = vi.fn();
|
||||
render(
|
||||
|
||||
Reference in new issue
Block a user