Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Keep the steering notice inside the composer

Claudec57097b9e5aa
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.js
index 09b25026b..209f4f161 100644
--- a/src/chrome/src/ui/sidepanel.js
+++ b/src/chrome/src/ui/sidepanel.js
@@ -8745,7 +8745,10 @@ function showComposerToast(message, { duration = 2600, effect = '' } = {}) {
toast.className = 'composer-toast';
toast.setAttribute('role', 'status');
toast.setAttribute('aria-live', 'polite');
- inputArea?.parentNode?.insertBefore(toast, inputArea);
+ // Inside the composer, not between it and the activity bar above: there it
+ // touched that bar and floated over a strip of panel background, cut off
+ // from the composer by the input area's top border.
+ inputArea?.prepend(toast);
}
if (isSystemHtml(message)) toast.innerHTML = message.__systemHtml;
else toast.textContent = message;
diff --git a/src/chrome/styles/sidepanel.css b/src/chrome/styles/sidepanel.css
index a57b7cb89..9f3faff36 100644
--- a/src/chrome/styles/sidepanel.css
+++ b/src/chrome/styles/sidepanel.css
@@ -1316,8 +1316,10 @@ html[dir="rtl"] .language-picker-menu {
#header { padding-inline: 8px; }
}
+/* First child of #input-area, so it shares the composer's gutters; the gap
+ below matches the queued-message and attachment rows. */
.composer-toast {
- margin: 0 12px 6px 12px;
+ margin: 0 0 8px;
padding: 7px 11px;
background: var(--bg-input);
border: 1px solid var(--border);
diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.js
index 6f1e82bd8..8c0f533ba 100644
--- a/src/firefox/src/ui/sidepanel.js
+++ b/src/firefox/src/ui/sidepanel.js
@@ -8531,7 +8531,10 @@ function showComposerToast(message, { duration = 2600, effect = '' } = {}) {
toast.className = 'composer-toast';
toast.setAttribute('role', 'status');
toast.setAttribute('aria-live', 'polite');
- inputArea?.parentNode?.insertBefore(toast, inputArea);
+ // Inside the composer, not between it and the activity bar above: there it
+ // touched that bar and floated over a strip of panel background, cut off
+ // from the composer by the input area's top border.
+ inputArea?.prepend(toast);
}
if (isSystemHtml(message)) toast.innerHTML = message.__systemHtml;
else toast.textContent = message;
diff --git a/src/firefox/styles/sidepanel.css b/src/firefox/styles/sidepanel.css
index 51e2bd3ee..3aa928026 100644
--- a/src/firefox/styles/sidepanel.css
+++ b/src/firefox/styles/sidepanel.css
@@ -1148,8 +1148,10 @@ html[dir="rtl"] .language-picker-menu {
#header { padding-inline: 8px; }
}
+/* First child of #input-area, so it shares the composer's gutters; the gap
+ below matches the queued-message and attachment rows. */
.composer-toast {
- margin: 0 12px 6px 12px;
+ margin: 0 0 8px;
padding: 7px 11px;
background: var(--bg-input);
border: 1px solid var(--border);
diff --git a/test/chat-steering-ui.mjs b/test/chat-steering-ui.mjs
index 826f99fae..ecea3ccc8 100644
--- a/test/chat-steering-ui.mjs
+++ b/test/chat-steering-ui.mjs
@@ -48,6 +48,44 @@ for (const [build, engine] of [['chrome', chromium], ['firefox', firefox]]) {
assert.equal(await page.locator('#live').textContent(), '');
} finally { await browser.close(); }
});
+ test(`${build}: the steering notice sits inside the composer on its gutters`, async () => {
+ const browser = await engine.launch({ headless: true });
+ try {
+ const page = await browser.newPage({ viewport: { width: 360, height: 640 } });
+ const html = read(build, 'src/ui/sidepanel.html');
+ const source = read(build, 'src/ui/sidepanel.js');
+ const start = html.indexOf('<div id="agent-activity"');
+ const end = html.indexOf('<button id="selection-ask-action"', start);
+ assert.ok(start >= 0 && end > start);
+ await page.setContent(`<style>${read(build, 'styles/sidepanel.css')}</style><div id="app">${html.slice(start, end)}`);
+ await page.addScriptTag({ content: `
+ var inputArea = document.getElementById('input-area');
+ var composerToastTimer = null;
+ function isSystemHtml() { return false; }
+ ${extract(source, 'showComposerToast')}
+ document.getElementById('agent-activity').classList.remove('hidden');
+ const queue = document.getElementById('queued-messages');
+ queue.classList.remove('hidden');
+ queue.innerHTML = '<div class="queued-message" role="listitem"><span class="queued-message-label">Queued</span><span class="queued-message-text">Next</span></div>';
+ showComposerToast('sp.steer.sent', { duration: 60000 });
+ ` });
+ const box = await page.evaluate(() => {
+ const rect = id => document.getElementById(id).getBoundingClientRect();
+ const toast = document.getElementById('composer-toast');
+ return {
+ parent: toast.parentElement.id, toast: toast.getBoundingClientRect(),
+ activity: rect('agent-activity'), area: rect('input-area'), queue: rect('queued-messages'), wrapper: rect('input-wrapper'),
+ };
+ });
+ assert.equal(box.parent, 'input-area', 'The notice belongs to the composer, not the strip above it');
+ assert.ok(box.toast.top >= box.area.top + 8, 'The notice keeps the composer padding below the activity bar');
+ assert.equal(box.toast.left, box.wrapper.left, 'The notice shares the composer gutter');
+ assert.equal(box.toast.right, box.wrapper.right, 'The notice shares the composer gutter');
+ assert.equal(box.queue.top - box.toast.bottom, 8, 'The notice keeps the queued-row gap');
+ } finally {
+ await browser.close();
+ }
+ });
test(`${build}: native composer honors delivery settings, explicitly steers, and preserves drafts across races`, async () => {
const browser = await engine.launch({ headless: true });
try {