fix(mobile-chat): send cursor matches attach-only enabled state (#2762 residual) #2779

Merged
devops-engineer merged 1 commits from fix/2762-attach-cursor-residual into main 2026-06-13 21:51:45 +00:00
2 changed files with 21 additions and 2 deletions
+4 -1
View File
@@ -847,7 +847,10 @@ export function MobileChat({
height: 36,
borderRadius: 999,
border: "none",
cursor: (draft.trim() || pendingFiles.length === 0) && !uploading ? "pointer" : "not-allowed",
cursor:
(draft.trim() || pendingFiles.length > 0) && reachable && !uploading
? "pointer"
: "not-allowed",
flexShrink: 0,
background:
(draft.trim() || pendingFiles.length > 0) && reachable && !uploading
@@ -258,12 +258,28 @@ describe("MobileChat — composer", () => {
expect(sendBtn).toBeTruthy();
});
it("Send button is disabled when textarea is empty (no draft)", () => {
it("Send button is disabled when textarea is empty (no draft)", async () => {
const { container } = renderChat(mockAgentId);
const sendBtn = container.querySelector('[aria-label="Send"]') as HTMLButtonElement;
expect(sendBtn.disabled).toBe(true);
});
// Regression #2762-follow-up: the send cursor used `pendingFiles.length === 0`,
// so attaching a file without typing text left the button enabled but showed a
// `not-allowed` cursor. It must be consistent with the disabled prop.
it("Send button is enabled and shows pointer cursor when files are attached but draft is empty", async () => {
const { container } = renderChat(mockAgentId);
const fileInput = container.querySelector('input[type="file"]') as HTMLInputElement;
const file = new File(["hello"], "note.txt", { type: "text/plain" });
await act(async () => {
fireEvent.change(fileInput, { target: { files: [file] } });
});
const sendBtn = container.querySelector('[aria-label="Send"]') as HTMLButtonElement;
expect(sendBtn.disabled).toBe(false);
expect(sendBtn.style.cursor).toBe("pointer");
});
// Regression #224: the composer textarea must render with font-size
// ≥ 16px. iOS Safari and PWAs auto-zoom the viewport when a focused
// input has a computed font-size below 16px — the layout jumps and