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:
chengyongru authored and chengyongru committed 2026-11-13 23:37:07 +08:00
1 parent e65bec9a6e
commit ce3f36983d
58 files changed
+1874 -453

No files matched your search

@@ -185,3 +185,42 @@ describe("ModelPresetBadge selected preset tooltip", () => {
await waitFor(() => expect(screen.queryByRole("tooltip")).not.toBeInTheDocument());
});
});
describe("ModelPresetBadge dismissal focus", () => {
it("does not request composer focus for an outside click", async () => {
const user = userEvent.setup();
const onRequestComposerFocus = vi.fn();
render(<><ModelPresetBadge label="zhipu" modelPreset="zhipu" modelPresets={presets}
onPresetChange={vi.fn()} onRequestComposerFocus={onRequestComposerFocus} isHero /><input aria-label="Other field" /></>);
await user.click(screen.getByRole("button", { name: "zhipu" }));
const outside = screen.getByRole("textbox", { name: "Other field" });
await user.click(outside);
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(outside).toHaveFocus();
expect(onRequestComposerFocus).not.toHaveBeenCalled();
});
it("returns keyboard Escape to the picker rather than requesting composer focus", async () => {
const user = userEvent.setup();
const onRequestComposerFocus = vi.fn();
render(<ModelPresetBadge label="zhipu" modelPreset="zhipu" modelPresets={presets}
onPresetChange={vi.fn()} onRequestComposerFocus={onRequestComposerFocus} isHero />);
const trigger = screen.getByRole("button", { name: "zhipu" });
await user.tab();
await user.keyboard("{Enter}{Escape}");
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
await waitFor(() => expect(trigger).toHaveFocus());
expect(onRequestComposerFocus).not.toHaveBeenCalled();
});
it("requests composer focus once after a picker selection closes", async () => {
const user = userEvent.setup();
const onRequestComposerFocus = vi.fn();
render(<ModelPresetBadge label="zhipu" modelPreset="zhipu" modelPresets={presets}
onPresetChange={vi.fn()} onRequestComposerFocus={onRequestComposerFocus} isHero />);
await user.click(screen.getByRole("button", { name: "zhipu" }));
await user.click(screen.getByRole("option", { name: "codex" }));
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(onRequestComposerFocus).toHaveBeenCalledTimes(1);
});
});