Skip to content

Agent Zero AI framework

Fix mobile composer and welcome sizing

Alessandro7533d35e4f40
diff --git a/tests/test_chat_input_drafts.py b/tests/test_chat_input_drafts.py
index 398cdf920..29897bf77 100644
--- a/tests/test_chat_input_drafts.py
+++ b/tests/test_chat_input_drafts.py
@@ -86,6 +86,17 @@ globalThis.sendMessage = async () => {{ sent = model.message; }};
await model.sendMessage();
assert(sent === "welcome prompt", "creating a chat erased the Welcome prompt");
assert(sessionStorage.getItem("a0:chat-draft:chat-new") === "welcome prompt", "first prompt did not follow its new chat");
+
+const editor = {{
+ style: {{ height: "240px" }},
+ get scrollHeight() {{ throw new Error("composer sizing must not freeze a transient layout"); }},
+}};
+model._editorEl = editor;
+model.adjustTextareaHeight();
+assert(editor.style.height === "auto", "composer retained its measured height");
+model.adjustTextareaHeight();
+assert(editor.style.height === "auto", "repeated sizing froze the composer height");
+model.unmountEditor(editor);
"""
subprocess.run(["node", "--input-type=module", "-e", script], check=True, text=True)
diff --git a/webui/components/chat/AGENTS.md b/webui/components/chat/AGENTS.md
index a05559d1e..a013ad0a3 100644
--- a/webui/components/chat/AGENTS.md
+++ b/webui/components/chat/AGENTS.md
@@ -22,6 +22,7 @@
- Text-only and attachment sends must render the first user turn immediately with the request message ID so the backend log merges into the same row.
- Unsent composer text is kept as a separate browser-session draft for each selected chat and restored when switching contexts; a Welcome-screen prompt must follow the chat created for its first send.
- Composer text uses the main UI font by default; typing a triple-backtick fence and pressing Enter turns that line into a visual code block that serializes back to fenced Markdown, while pasted fenced Markdown stays plain text.
+- The contenteditable composer sizes naturally between its CSS minimum and maximum heights; do not freeze measured scroll heights into pixels during mounting or editing.
- Missing model setup is gated at send intent: the first unconfigured send renders an in-thread setup card, keeps the pending prompt in browser session storage for refresh recovery, and must not call `/message_async` until a chat model is configured.
- While the setup gate is open, the composer remains typeable but send is blocked until setup succeeds.
- The setup gate must delegate Cloud/Local setup, account connections, and advanced model configuration to the existing onboarding and model-preset editor modals; do not duplicate provider/model/key forms inline.
diff --git a/webui/components/chat/input/input-store.js b/webui/components/chat/input/input-store.js
index b54e2acaa..1e04bdccb 100644
--- a/webui/components/chat/input/input-store.js
+++ b/webui/components/chat/input/input-store.js
@@ -417,10 +417,8 @@ const model = {
adjustTextareaHeight($event = null) {
const target = $event?.target || null;
for (const chatInput of this._composerTextareas(target)) {
+ // Contenteditable grows naturally; freezing scrollHeight can retain a transient layout.
chatInput.style.height = "auto";
- chatInput.style.height = chatInput.scrollHeight + "px";
- // pick up any layout shift triggered by the height assignment
- chatInput.style.height = Math.max(chatInput.scrollHeight, parseInt(chatInput.style.height)) + "px";
}
},
diff --git a/webui/components/welcome/AGENTS.md b/webui/components/welcome/AGENTS.md
index 133822697..1601bd164 100644
--- a/webui/components/welcome/AGENTS.md
+++ b/webui/components/welcome/AGENTS.md
@@ -20,6 +20,7 @@
- The welcome screen mounts the shared chat composer to start a new chat; keep it mutually exclusive with the normal chat input DOM.
- Keep the welcome container background transparent so the persistent right-panel background transition remains visible when entering and leaving Welcome.
- Reserve the welcome composer's final minimum height before its nested input components hydrate.
+- On mobile, keep composer actions on one row and reduce only the placeholder font; editable text stays at least 16px. Quick-action buttons use a flex layout with native appearance disabled for stable initial and touch sizing.
- Render `system-resources` as the dedicated System Resources panel, not as a generic alert banner.
- Utility quick actions from welcome must keep the first screen intact; use modal/floating entry points instead of docking the right canvas beside welcome content.
diff --git a/webui/components/welcome/welcome-screen.html b/webui/components/welcome/welcome-screen.html
index 3919b423f..0992c3bdb 100644
--- a/webui/components/welcome/welcome-screen.html
+++ b/webui/components/welcome/welcome-screen.html
@@ -254,6 +254,7 @@
.welcome-composer #chat-input {
min-height: 3.2rem;
+ padding-right: 0.35rem;
font-size: 1.03rem;
}
@@ -455,8 +456,8 @@
}
.welcome-action-card {
- display: grid;
- grid-template-columns: auto minmax(0, 1fr) auto;
+ appearance: none;
+ display: flex;
align-items: center;
gap: 1rem;
min-height: 6.1rem;
@@ -496,6 +497,7 @@
.welcome-action-copy {
display: grid;
+ flex: 1;
min-width: 0;
gap: 0.28rem;
}
@@ -714,37 +716,26 @@
font-size: 2rem;
}
+ .welcome-composer,
.welcome-composer .input-row {
- align-items: center;
- flex-wrap: wrap;
min-height: 4.35rem;
- row-gap: 0.55rem;
- white-space: normal;
}
.welcome-composer #chat-input-container {
- flex: 1 1 11.5rem;
+ flex: 1;
width: auto;
- min-width: min(11.5rem, calc(100% - 3rem));
}
.welcome-composer #chat-input {
- min-height: 4.5rem;
- padding-right: 0.35rem;
- align-content: center;
- }
-
- .welcome-composer #chat-input.is-empty {
- overflow-y: hidden;
- scrollbar-width: none;
+ min-height: 2.8rem;
+ padding-block: 0.5rem;
+ font-size: 1rem;
}
- .welcome-composer #chat-input.is-empty::-webkit-scrollbar {
- display: none;
- }
-
- .welcome-composer #chat-buttons-wrapper {
- margin-left: auto;
+ .welcome-composer #chat-input.is-empty::before {
+ display: block;
+ font-size: 0.875rem;
+ line-height: 1.35;
}
.welcome-banner {
@@ -788,15 +779,6 @@
}
}
- @media (max-width: 420px) {
- .welcome-composer #chat-input.is-empty {
- min-height: 5rem;
- padding-top: 0.52rem;
- padding-bottom: 0.52rem;
- font-size: 0.96rem;
- line-height: 1.34;
- }
- }
</style>
</body>