Skip to content

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

Fix composer detection and eligible text click preference

Emre Sokullu6b5443ddefb6
diff --git a/src/chrome/src/content/content.js b/src/chrome/src/content/content.js
index 39a057872..17e9f1996 100644
--- a/src/chrome/src/content/content.js
+++ b/src/chrome/src/content/content.js
@@ -1575,6 +1575,25 @@
_observeDomRevisionRoot(document);
}
+ // Text preference and recipient preflight must use the control that can
+ // actually receive the click, including when the label is a passive child.
+ function _isEligibleTextClickTarget(el) {
+ try {
+ const control = _resolveInteractiveAncestor(el) || el;
+ const r = control.getBoundingClientRect();
+ if (r.width < 1 || r.height < 1) return false;
+ if (control.disabled === true || control.matches?.(':disabled')
+ || control.getAttribute?.('aria-disabled') === 'true') return false;
+ const hit = _shadowAwareElementFromPoint(
+ Math.round(r.left + r.width / 2),
+ Math.round(r.top + r.height / 2),
+ );
+ return !!hit && (hit === control || control.contains?.(hit) || hit.contains?.(control));
+ } catch {
+ return false;
+ }
+ }
+
const _textCandidateCache = new WeakMap();
function _clickTextCandidates(scope) {
_ensureDomRevisionObserver();
@@ -1607,14 +1626,16 @@
for (const e of candidates) {
if (!_hasVisibleBox(e)) continue;
const text = _siteInteractionText(e).toLowerCase();
- if (text) out.push({ e, txt: text });
+ if (text) out.push({ e, txt: text, primary: true });
// A control's aria-label / title / placeholder often names it far better
// than its visible glyphs — icon-only buttons and combobox-style fields
// ("Search for contacts") are unreachable by visible text alone. Offer
// those as extra needles so a text click resolves in one round trip.
+ // They are secondary (primary: false): in ambiguity resolution a
+ // visible-text match on a different control must not lose to them.
for (const attr of ['aria-label', 'title', 'placeholder', 'data-tooltip']) {
const value = String(e.getAttribute?.(attr) || '').trim().toLowerCase();
- if (value && value !== text) out.push({ e, txt: value });
+ if (value && value !== text) out.push({ e, txt: value, primary: false });
}
}
_textCandidateCache.set(cacheScope, { revision, list: out });
@@ -1806,6 +1827,30 @@
textResolvedExact = (usedMode === 'exact');
}
}
+ if (!el && matches.length > 1) {
+ // A control's own visible text outranks an attribute-derived needle
+ // (aria-label, title, placeholder, data-tooltip) on a DIFFERENT
+ // control. An input's competing aria-label must not turn a genuinely
+ // labeled submit button into a false ambiguity — the submit probe in
+ // agent.js ranks aria-label below innerText/value/placeholder for
+ // exactly this reason. Icon-only controls are unaffected: with no
+ // visible glyphs their aria-label is their primary text.
+ const eligibleMatches = matches.filter(m => _isEligibleTextClickTarget(m.e));
+ const primaryMatches = eligibleMatches.filter(m => m.primary === true);
+ if (primaryMatches.length > 0 && primaryMatches.length < matches.length) {
+ const primaryCollapsed = new Map();
+ for (const m of primaryMatches) {
+ const actionable = _resolveInteractiveAncestor(m.e) || m.e;
+ if (!primaryCollapsed.has(actionable)) primaryCollapsed.set(actionable, m);
+ }
+ if (primaryCollapsed.size === 1) {
+ const [entry] = primaryCollapsed.values();
+ el = _resolveInteractiveAncestor(entry.e) || entry.e;
+ textResolvedExact = (usedMode === 'exact');
+ matches = [entry];
+ }
+ }
+ }
if (!el && matches.length > 1) {
// Prefer interactive elements over passive children (label, span, etc.)
const interactiveMatches = matches.filter(m => _isInteractive(m.e));
@@ -1819,20 +1864,8 @@
// click would hit, and often to a single element, which then resolves
// here instead of spending an entire LLM turn on candidate
// coordinates.
- const hitTargetPool = (interactiveMatches.length > 1 ? interactiveMatches : matches).filter(m => {
- try {
- const r = m.e.getBoundingClientRect();
- if (r.width < 1 || r.height < 1) return false;
- if (m.e.disabled === true || m.e.getAttribute?.('aria-disabled') === 'true') return false;
- const hit = _shadowAwareElementFromPoint(
- Math.round(r.left + r.width / 2),
- Math.round(r.top + r.height / 2),
- );
- return !!hit && (hit === m.e || m.e.contains?.(hit) || hit.contains?.(m.e));
- } catch {
- return false;
- }
- });
+ const hitTargetPool = (interactiveMatches.length > 1 ? interactiveMatches : matches)
+ .filter(m => _isEligibleTextClickTarget(m.e));
if (hitTargetPool.length === 1) {
el = _resolveInteractiveAncestor(hitTargetPool[0].e) || hitTargetPool[0].e;
textResolvedExact = (usedMode === 'exact');
@@ -5655,9 +5688,17 @@
let matches = candidates.filter(({ txt }) => mode === 'exact' ? txt === needle
: mode === 'prefix' ? txt.startsWith(needle)
: mode === 'contains' ? txt.includes(needle) : false);
- // Dispatch prefers the sole interactive match over passive labels.
- // Multiple interactive matches must still stop at this match tier.
+ // Dispatch prefers the sole visible-text match over an
+ // attribute-derived needle on a different control, then the sole
+ // interactive match over passive labels. Multiple matches of the
+ // same tier must still stop at this match tier.
if (matches.length > 1) {
+ const eligibleMatches = matches.filter(({ e }) => _isEligibleTextClickTarget(e));
+ if (eligibleMatches.length) matches = eligibleMatches;
+ const primaryMatches = eligibleMatches.filter(({ primary }) => primary === true);
+ if (primaryMatches.length > 0 && primaryMatches.length < matches.length) {
+ matches = primaryMatches;
+ }
const interactiveMatches = matches.filter(({ e }) => _isInteractive(e));
if (interactiveMatches.length === 1) matches = interactiveMatches;
}
@@ -5699,14 +5740,6 @@
? (twitterComposers.length === 1 ? twitterComposers[0] : null)
: composerCandidates[0] || null;
const layoutCandidateRect = layoutCandidate?.getBoundingClientRect?.();
- // A recipient/search field can be the only focused editable while the
- // real composer is temporarily hidden. Never promote an upper-page
- // editable into the message composer merely because it is focused.
- const layoutComposer = layoutCandidate
- && (!viewportHeight || layoutCandidateRect?.bottom >= viewportHeight * 0.5)
- ? layoutCandidate
- : null;
-
const independentScrollableRegion = (el, excluded) => {
let node = el || null;
while (node && node !== document.body) {
@@ -6045,6 +6078,27 @@
return editors.length === 1;
};
+ // A recipient/search field can be the only focused editable while the
+ // real composer is temporarily hidden. Focus alone is not compose proof.
+ // Upper-page dialogs also contain search and filter fields. Exempt a
+ // message-body editor from the position rule only when its own dialog
+ // exposes a send control or a verified LinkedIn public-post control.
+ const dialogSelector = 'dialog,[role="dialog"],[role="alertdialog"],[aria-modal="true"]';
+ const layoutDialog = layoutCandidate?.closest?.(dialogSelector);
+ const layoutInComposeDialog = !!layoutDialog
+ && !verifiedNavigationEditable(layoutCandidate)
+ && layoutCandidate.matches?.('textarea,[contenteditable="true"],[role="textbox"]:not(input)')
+ && Array.from(layoutDialog.querySelectorAll('button,[role="button"],input[type="submit"],input[type="button"],[data-action]'))
+ .some(control => visible(control) && control.closest(dialogSelector) === layoutDialog
+ && (_hasMessageCommitName(control.getAttribute('aria-label') || control.value || control.innerText || control.textContent)
+ || verifiedLinkedInPublicPostControl(control)));
+ const layoutComposer = layoutCandidate
+ && (layoutInComposeDialog
+ || !viewportHeight
+ || layoutCandidateRect?.bottom >= viewportHeight * 0.5)
+ ? layoutCandidate
+ : null;
+
let composer = null;
let messageSend = null;
const discordManagementTarget = tool === 'press_keys' && String(args.key) === 'Enter'
@@ -6173,7 +6227,19 @@
// still commit without a composer — a send/commit-labelled control,
// a messaging app's Reply/Reply all/Forward opener, or anything
// inside the app's messaging surface — stay fail-closed.
+ // LinkedIn is the strictest contract: every control that may act
+ // without a composer has a verified classifier above (post entry,
+ // public Post, navigation). A control that matched none of them is
+ // unverified, so it is NOT proven non-message. A button-like
+ // control or a link the classifier saw but declined to verify
+ // (fragment, script:, mailto:, profile, unknown route) fails closed
+ // instead of being approved.
+ const linkedInUnverified = params.adapterName === 'linkedin' && (
+ control.matches?.('button,[role="button"],input[type="submit"],input[type="button"],[data-action]') === true
+ || (control.matches?.('a[href]') === true && linkedInNavigation === 'none')
+ );
const provenNonMessage = !composerSetup
+ && !linkedInUnverified
&& !_hasMessageCommitName(actionLabel)
&& !_inMessagingSurface(control);
if (provenNonMessage) {
@@ -6187,6 +6253,19 @@
identityCandidates: [],
};
}
+ if (linkedInUnverified) {
+ // No reasonCode: the agent maps a LinkedIn composer-less failure
+ // to its own contract (message_send_classification_inconclusive,
+ // retryable: false, "no message composer" guidance). Naming a
+ // reason here would override that contract.
+ return {
+ success: true,
+ messageSend: null,
+ conclusive: false,
+ composerAvailable: false,
+ identityCandidates: [],
+ };
+ }
return {
success: true,
messageSend: null,
diff --git a/src/firefox/src/content/content.js b/src/firefox/src/content/content.js
index e43464e27..116eb071f 100644
--- a/src/firefox/src/content/content.js
+++ b/src/firefox/src/content/content.js
@@ -1539,6 +1539,25 @@
} catch { /* leave other observable roots cacheable */ }
}
+ // Text preference and recipient preflight must use the control that can
+ // actually receive the click, including when the label is a passive child.
+ function _isEligibleTextClickTarget(el) {
+ try {
+ const control = _resolveInteractiveAncestor(el) || el;
+ const r = control.getBoundingClientRect();
+ if (r.width < 1 || r.height < 1) return false;
+ if (control.disabled === true || control.matches?.(':disabled')
+ || control.getAttribute?.('aria-disabled') === 'true') return false;
+ const hit = _shadowAwareElementFromPoint(
+ Math.round(r.left + r.width / 2),
+ Math.round(r.top + r.height / 2),
+ );
+ return !!hit && (hit === control || control.contains?.(hit) || hit.contains?.(control));
+ } catch {
+ return false;
+ }
+ }
+
const _textCandidateCache = new WeakMap();
function _clickTextCandidates(scope) {
_observeDomRevisionRoot(document);
@@ -1607,10 +1626,12 @@
const list = [];
for (const e of all) {
const text = _normTxt(e);
- if (text) list.push({ e, txt: text });
+ if (text) list.push({ e, txt: text, primary: true });
+ // Secondary needles (primary: false): in ambiguity resolution a
+ // visible-text match on a different control must not lose to them.
for (const attr of ['aria-label', 'title', 'placeholder', 'data-tooltip']) {
const value = String(e.getAttribute?.(attr) || '').trim().toLowerCase();
- if (value && value !== text) list.push({ e, txt: value });
+ if (value && value !== text) list.push({ e, txt: value, primary: false });
}
}
_textCandidateCache.set(cacheScope, { revision, list });
@@ -2118,26 +2139,38 @@
textResolvedExact = (usedMode === 'exact');
}
}
+ if (!el && matches.length > 1) {
+ // A control's own visible text outranks an attribute-derived needle
+ // (aria-label, title, placeholder, data-tooltip) on a DIFFERENT
+ // control. An input's competing aria-label must not turn a genuinely
+ // labeled submit button into a false ambiguity — the submit probe in
+ // agent.js ranks aria-label below innerText/value/placeholder for
+ // exactly this reason. Icon-only controls are unaffected: with no
+ // visible glyphs their aria-label is their primary text.
+ const eligibleMatches = matches.filter(m => _isEligibleTextClickTarget(m.e));
+ const primaryMatches = eligibleMatches.filter(m => m.primary === true);
+ if (primaryMatches.length > 0 && primaryMatches.length < matches.length) {
+ const primaryCollapsed = new Map();
+ for (const m of primaryMatches) {
+ const actionable = _resolveInteractiveAncestor(m.e) || m.e;
+ if (!primaryCollapsed.has(actionable)) primaryCollapsed.set(actionable, m);
+ }
+ if (primaryCollapsed.size === 1) {
+ const [entry] = primaryCollapsed.values();
+ el = _resolveInteractiveAncestor(entry.e) || entry.e;
+ textResolvedExact = (usedMode === 'exact');
+ matches = [entry];
+ }
+ }
+ }
if (!el && matches.length > 1) {
// Prefer interactive elements over passive children (label, span, etc.)
const interactiveMatches = matches.filter(m => _isInteractive(m.e));
if (interactiveMatches.length === 1) {
matches = interactiveMatches;
} else {
- const hitTargetPool = (interactiveMatches.length > 1 ? interactiveMatches : matches).filter(m => {
- try {
- const r = m.e.getBoundingClientRect();
- if (r.width < 1 || r.height < 1) return false;
- if (m.e.disabled === true || m.e.getAttribute?.('aria-disabled') === 'true') return false;
- const hit = _shadowAwareElementFromPoint(
- Math.round(r.left + r.width / 2),
- Math.round(r.top + r.height / 2),
- );
- return !!hit && (hit === m.e || m.e.contains?.(hit) || hit.contains?.(m.e));
- } catch {
- return false;
- }
- });
+ const hitTargetPool = (interactiveMatches.length > 1 ? interactiveMatches : matches)
+ .filter(m => _isEligibleTextClickTarget(m.e));
if (hitTargetPool.length === 1) {
el = _resolveInteractiveAncestor(hitTargetPool[0].e) || hitTargetPool[0].e;
textResolvedExact = (usedMode === 'exact');
@@ -4524,6 +4557,16 @@
}
}
+ const _MESSAGE_COMMIT_LABEL_RE = new RegExp(
+ '(?:^|[^\\p{L}])(?:send|enviar|envoyer|invia|senden|verzenden|gönder|отправить|送信|发送|發送|보내|إرسال|ارسال)(?:[^\\p{L}]|$)',
+ 'iu',
+ );
+
+ function _hasMessageCommitName(value) {
+ const text = String(value ?? '').replace(/\s+/g, ' ').trim();
+ return !!text && _MESSAGE_COMMIT_LABEL_RE.test(text);
+ }
+
function _probeMessageRecipientGuard(params = {}) {
try {
const tool = String(params.tool || '');
@@ -4733,9 +4776,17 @@
let matches = candidates.filter(({ txt }) => mode === 'exact' ? txt === needle
: mode === 'prefix' ? txt.startsWith(needle)
: mode === 'contains' ? txt.includes(needle) : false);
- // Dispatch prefers the sole interactive match over passive labels.
- // Multiple interactive matches must still stop at this match tier.
+ // Dispatch prefers the sole visible-text match over an
+ // attribute-derived needle on a different control, then the sole
+ // interactive match over passive labels. Multiple matches of the
+ // same tier must still stop at this match tier.
if (matches.length > 1) {
+ const eligibleMatches = matches.filter(({ e }) => _isEligibleTextClickTarget(e));
+ if (eligibleMatches.length) matches = eligibleMatches;
+ const primaryMatches = eligibleMatches.filter(({ primary }) => primary === true);
+ if (primaryMatches.length > 0 && primaryMatches.length < matches.length) {
+ matches = primaryMatches;
+ }
const interactiveMatches = matches.filter(({ e }) => _isInteractive(e));
if (interactiveMatches.length === 1) matches = interactiveMatches;
}
@@ -4777,14 +4828,6 @@
? (twitterComposers.length === 1 ? twitterComposers[0] : null)
: composerCandidates[0] || null;
const layoutCandidateRect = layoutCandidate?.getBoundingClientRect?.();
- // A recipient/search field can be the only focused editable while the
- // real composer is temporarily hidden. Never promote an upper-page
- // editable into the message composer merely because it is focused.
- const layoutComposer = layoutCandidate
- && (!viewportHeight || layoutCandidateRect?.bottom >= viewportHeight * 0.5)
- ? layoutCandidate
- : null;
-
const independentScrollableRegion = (el, excluded) => {
let node = el || null;
while (node && node !== document.body) {
@@ -5123,6 +5166,27 @@
return editors.length === 1;
};
+ // A recipient/search field can be the only focused editable while the
+ // real composer is temporarily hidden. Focus alone is not compose proof.
+ // Upper-page dialogs also contain search and filter fields. Exempt a
+ // message-body editor from the position rule only when its own dialog
+ // exposes a send control or a verified LinkedIn public-post control.
+ const dialogSelector = 'dialog,[role="dialog"],[role="alertdialog"],[aria-modal="true"]';
+ const layoutDialog = layoutCandidate?.closest?.(dialogSelector);
+ const layoutInComposeDialog = !!layoutDialog
+ && !verifiedNavigationEditable(layoutCandidate)
+ && layoutCandidate.matches?.('textarea,[contenteditable="true"],[role="textbox"]:not(input)')
+ && Array.from(layoutDialog.querySelectorAll('button,[role="button"],input[type="submit"],input[type="button"],[data-action]'))
+ .some(control => visible(control) && control.closest(dialogSelector) === layoutDialog
+ && (_hasMessageCommitName(control.getAttribute('aria-label') || control.value || control.innerText || control.textContent)
+ || verifiedLinkedInPublicPostControl(control)));
+ const layoutComposer = layoutCandidate
+ && (layoutInComposeDialog
+ || !viewportHeight
+ || layoutCandidateRect?.bottom >= viewportHeight * 0.5)
+ ? layoutCandidate
+ : null;
+
let composer = null;
let messageSend = null;
const discordManagementTarget = tool === 'press_keys' && String(args.key) === 'Enter'
@@ -5229,14 +5293,24 @@
);
const composerSetup = params.adapterName === 'gmail'
&& /^(?:reply|reply all|forward)$/i.test(actionLabel);
- const messageCommit = /(?:^|[^\p{L}])(?:send|enviar|envoyer|invia|senden|verzenden|gönder|отправить|送信|发送|發送|보내|إرسال|ارسال)(?:[^\p{L}]|$)/iu
- .test(actionLabel);
+ const messageCommit = _hasMessageCommitName(actionLabel);
const messagingSurface = (() => {
try {
return !!control.closest?.('[class*="msg-"],[class*="messaging"],[id*="messaging"],[data-messaging],[data-test-messaging],[role="log"]');
} catch { return false; }
})();
- if (!composerSetup && !messageCommit && !messagingSurface) {
+ // LinkedIn is the strictest contract: every control that may act
+ // without a composer has a verified classifier above (post entry,
+ // public Post, navigation). A control that matched none of them is
+ // unverified, so it is NOT proven non-message. A button-like
+ // control or a link the classifier saw but declined to verify
+ // (fragment, script:, mailto:, profile, unknown route) fails closed
+ // instead of being approved.
+ const linkedInUnverified = params.adapterName === 'linkedin' && (
+ control.matches?.('button,[role="button"],input[type="submit"],input[type="button"],[data-action]') === true
+ || (control.matches?.('a[href]') === true && linkedInNavigation === 'none')
+ );
+ if (!composerSetup && !linkedInUnverified && !messageCommit && !messagingSurface) {
return {
success: true,
messageSend: false,
@@ -5247,6 +5321,19 @@
identityCandidates: [],
};
}
+ if (linkedInUnverified) {
+ // No reasonCode: the agent maps a LinkedIn composer-less failure
+ // to its own contract (message_send_classification_inconclusive,
+ // retryable: false, "no message composer" guidance). Naming a
+ // reason here would override that contract.
+ return {
+ success: true,
+ messageSend: null,
+ conclusive: false,
+ composerAvailable: false,
+ identityCandidates: [],
+ };
+ }
return {
success: true,
messageSend: null,
diff --git a/test/fixtures/interaction-review-regressions.mjs b/test/fixtures/interaction-review-regressions.mjs
new file mode 100644
index 000000000..f7a96c502
--- /dev/null
+++ b/test/fixtures/interaction-review-regressions.mjs
@@ -0,0 +1,101 @@
+import { strict as assert } from 'node:assert';
+
+export function registerInteractionReviewRegressions({
+ test, firefoxTest, setupContentHtml, call, Agent, FirefoxAgent,
+}) {
+ for (const [kind, register, AgentClass] of [
+ ['chrome', test, Agent],
+ ['firefox', firefoxTest, FirefoxAgent],
+ ]) {
+ register(`${kind}: text clicks prefer eligible controls before visible text`, async page => {
+ for (const variant of ['disabled', 'aria-disabled', 'fieldset', 'covered', 'enabled']) {
+ await setupContentHtml(page, `<!doctype html>
+ <style>
+ body { margin: 0 }
+ button { position: fixed; top: 40px; width: 100px; height: 40px }
+ #primary { left: 40px } #glyph { left: 200px }
+ #cover { position: fixed; top: 40px; left: 40px; width: 100px; height: 40px; z-index: 10 }
+ </style>
+ <fieldset ${variant === 'fieldset' ? 'disabled' : ''}>
+ <button id="primary" ${variant === 'disabled' ? 'disabled' : ''}
+ ${variant === 'aria-disabled' ? 'aria-disabled="true"' : ''}><span aria-label="Search">Search</span></button>
+ </fieldset>
+ <button id="glyph" aria-label="Search">⌕</button>
+ ${variant === 'covered' ? '<div id="cover"></div>' : ''}`, kind);
+ await page.evaluate(() => {
+ window.fixtureClicks = [];
+ document.querySelectorAll('button').forEach(button => {
+ button.addEventListener('click', () => window.fixtureClicks.push(button.id));
+ });
+ });
+ const args = { text: 'Search', textMatch: 'exact' };
+ const probe = await call(page, 'probe_message_recipient_guard', {
+ tool: 'click', args, adapterName: 'gmail',
+ });
+ assert.equal(probe.messageSend, false, JSON.stringify({ variant, probe }));
+ assert.equal(probe.conclusive, true, JSON.stringify({ variant, probe }));
+ const clicked = await call(page, 'click', args);
+ assert.equal(clicked.success, true, JSON.stringify({ variant, clicked }));
+ assert.deepEqual(await page.evaluate(() => window.fixtureClicks),
+ [variant === 'enabled' ? 'primary' : 'glyph'], variant);
+ }
+ });
+
+ register(`${kind}: Gmail advanced search dialog is not a message composer`, async page => {
+ await page.route('**/*', route => route.fulfill({ contentType: 'text/html', body: '<!doctype html>' }));
+ await page.goto('https://mail.google.com/mail/u/0/');
+ await setupContentHtml(page, `<!doctype html>
+ <style>
+ body { margin: 0 }
+ [role=dialog] { position: fixed; top: 20px; left: 40px; width: 400px; padding: 20px; background: white }
+ input, textarea { display: block; width: 300px; height: 40px }
+ </style>
+ <div role="dialog" aria-modal="true" aria-label="Advanced search">
+ <label>Has the words <input id="words" value="budget"></label>
+ <button id="search">Search</button>
+ </div>`, kind);
+ await page.locator('#words').focus();
+ await page.evaluate(() => {
+ window.fixtureClicks = 0;
+ document.querySelector('#search').addEventListener('click', () => window.fixtureClicks++);
+ });
+ const agent = new AgentClass({ getActive: () => ({ supportsVision: false }) });
+ agent._messageRecipientContentProbe = (_, params) => call(page, 'probe_message_recipient_guard', params);
+ for (const args of [{ selector: '#search' }, { text: 'Search', textMatch: 'exact' }]) {
+ const probe = await call(page, 'probe_message_recipient_guard', {
+ tool: 'click', args, adapterName: 'gmail',
+ });
+ assert.equal(probe.messageSend, false, JSON.stringify(probe));
+ assert.equal(probe.conclusive, true, JSON.stringify(probe));
+ assert.equal(await agent._messageRecipientGuardBlock(1, 'click', args, page.url()), null);
+ assert.equal((await call(page, 'click', args)).success, true);
+ }
+ assert.equal(await page.evaluate(() => window.fixtureClicks), 2);
+ // A multiline filter is still not compose evidence.
+ await page.locator('#words').evaluate(input => {
+ const textarea = document.createElement('textarea');
+ textarea.id = input.id;
+ textarea.value = input.value;
+ input.replaceWith(textarea);
+ textarea.focus();
+ });
+ const searchProbe = await call(page, 'probe_message_recipient_guard', {
+ tool: 'click', args: { selector: '#search' }, adapterName: 'gmail',
+ });
+ assert.equal(searchProbe.messageSend, false, JSON.stringify(searchProbe));
+ // A real upper-page composer must still require a recipient.
+ await page.evaluate(() => {
+ document.querySelector('[role=dialog]').setAttribute('aria-label', 'New Message');
+ const button = document.querySelector('#search');
+ button.id = 'send';
+ button.textContent = 'Send';
+ });
+ const sendProbe = await call(page, 'probe_message_recipient_guard', {
+ tool: 'click', args: { selector: '#send' }, adapterName: 'gmail',
+ });
+ assert.equal(sendProbe.messageSend, true, JSON.stringify(sendProbe));
+ assert.equal(sendProbe.composerAvailable, true, JSON.stringify(sendProbe));
+ assert.equal((await agent._messageRecipientGuardBlock(1, 'click', { selector: '#send' }, page.url()))?.noDispatch, true);
+ });
+ }
+}
diff --git a/test/fixtures/run.mjs b/test/fixtures/run.mjs
index 7e037d763..dcff13b2e 100644
--- a/test/fixtures/run.mjs
+++ b/test/fixtures/run.mjs
@@ -33,6 +33,7 @@ import {
} from '../../src/chrome/src/selection-shortcut-i18n.js';
import { registerRichTextToolbarFixtures } from './rich-text-toolbar.mjs';
import { registerMessageRecipientNavigationFixtures } from './message-recipient-navigation.mjs';
+import { registerInteractionReviewRegressions } from './interaction-review-regressions.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -684,7 +685,7 @@ test('press_keys rechecks its deadline after recipient validation', async (page)
#composer { position: fixed; bottom: 20px; left: 280px; width: 360px; height: 80px; }
</style>
<h1 id="recipient">Alice</h1>
- <textarea id="composer" aria-label="Message composer"></textarea>
+ <textarea id="composer" aria-label="Message composer">Hello Alice</textarea>
`, browserKind);
const binding = await page.evaluate(() => new Promise((resolve) => {
const composer = document.getElementById('composer');
@@ -754,7 +755,7 @@ test('click rechecks its deadline after recipient validation', async (page) => {
</style>
<h1 id="recipient">Alice</h1>
<form id="message-form">
- <textarea id="composer" aria-label="Message composer"></textarea>
+ <textarea id="composer" aria-label="Message composer">Hello Alice</textarea>
<button id="send" type="button">Send</button>
</form>
<script>
@@ -5313,6 +5314,7 @@ test('Firefox: type_text rejects disabled indexed text input fallback', async (p
registerMessageRecipientNavigationFixtures({ test, firefoxTest, setupContentHtml, call, Agent, FirefoxAgent });
+registerInteractionReviewRegressions({ test, firefoxTest, setupContentHtml, call, Agent, FirefoxAgent });
registerRichTextToolbarFixtures({
test,