Skip to content

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

Keep publishing menu buttons and deletions behind their checks, and replays model-free

Claudeb6368fd23d0b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a18344161..ae060fda7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,7 @@ This changelog was generated from the repository Git history and release tags. V
## [Unreleased]
### Fixed
-- What a clicked button does is decided by a model's reading of its caption, in any language, right before the click, no longer by word lists in about 13 languages. A Hungarian "Törlés" or Swedish "Radera" button now gets the same deletion check as "Delete" or "Sil" did; "Delete all" in any language gets no single record; "Remove filter" style buttons, composer tools and close buttons stay ordinary. A new caption is read once, by the decision model first, and while the main model decides on a page the decision model already reads that page's button captions, so most clicks wait for nothing. If no model can read a caption, the button is treated as an ordinary one, as any language outside the old lists always was.
+- What a clicked button does is decided by a model's reading of its caption, in any language, right before the click, no longer by word lists in about 13 languages. A Hungarian "Törlés" or Swedish "Radera" button now gets the same deletion check as "Delete" or "Sil" did; "Delete all" in any language gets no single record; "Remove filter" style buttons, composer tools and close buttons stay ordinary. A new caption is read once, by the decision model first, and while the main model decides on a page the decision model already reads that page's button captions, so most clicks wait for nothing. If no model can read a caption, the button is treated as an ordinary one, as any language outside the old lists always was. A menu button whose name reads as publishing still gets the publication checks, a button whose name reads as deleting is never taken for a draft edit, and replaying a saved workflow asks no main model for these readings.
- Chrome: when a click on a plain page element shows no effect, WebBrain clicks it once more with a real mouse click only if a model, reading the element's name in any language, does not see it sending, buying, deleting, liking, following or downloading something. The word lists in 17 languages that decided this are gone: "Fiók törlése" or "Radera konto" are now kept from a second click like "Delete account" was, while names like "Order history" or "Share price" are no longer treated as actions. A name the model cannot read keeps the retry, as any unlisted name did before.
- A click on a button of a Mastodon post shown on its own page, such as its "
" menu, or on a reply around it, is no longer thrown away and asked for again because the page or a reply changed while WebBrain was deciding. A post the page names as one item for screen readers now owns its own buttons, as posts in a timeline already do, while a change to that post, or another post taking its place, still stops the click.
- When a task ends, a search box with an "Ara", "Suchen" or "Buscar" button no longer counts as a form left unsent. Whether such a button only searches is read by the model in any language, instead of looking for the English words "search", "filter" or "go", which also matched words like "Google".
diff --git a/docs/architecture.md b/docs/architecture.md
index def58d015..12679f075 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -894,16 +894,18 @@ alone pre-reads the captions of the buttons, menu items and tabs its
accessibility tree shows, so a click usually finds them read.
Readings decide: a deletion (the record binding above, or no record for
-several items); a draft tool (a composer control not read as a commit, and a
-deletion or draft edit only when the removed item is visibly an attachment);
-an ordinary control (outside a form, not read as a publication, commit or
-deletion; for an X or Bluesky control with a non-publish test id or a popup
-launcher, a publication reading does not count); strong submit evidence for a
+several items); a draft tool (a composer control not read as a commit, a
+publication or a deletion, and a draft edit only when the removed item is
+visibly an attachment); an ordinary control (outside a form, not read as a
+publication, commit or deletion; for an X or Bluesky control with a
+non-publish test id a publication reading does not count, while a popup
+launcher read as publishing stays a commit); strong submit evidence for a
`type=button` control in a form (a caption read as a commit, publication or
next step); an unnamed X or Bluesky composer control read as a publication; a
-named button outside any form read as only changing the view (closing,
-cancelling, going back), which is not a submit; and Mastodon's own "
" menu
-and dangerous item. Form validation waits for a rejection after a caption read
+dialog's named button outside any form read as only changing the view
+(closing, cancelling, going back), which is not a submit; and Mastodon's own
+"
" menu and dangerous item. A saved workflow's deterministic replay asks the
+decision model alone for these readings, never the active model. Form validation waits for a rejection after a caption read
as a commit, a publication or a next step; a workflow click submits its form by
structure or such a caption; and a rapid second text click is a duplicate only
for a caption read as a commit or publication, asked then if the first click
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 8395e3930..d31677f71 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -7449,7 +7449,7 @@ export class Agent extends LoopDetector {
.filter(text => !this._pageTextReadings.has(this._pageTextKey(kind, text, context)));
if (!pending.length) return;
const readings = await this._semanticDecisions(tabId, kind, { items: pending.map(text => ({ ...context, text })) },
- { ...(mainTimeoutMs ? { mainTimeoutMs } : {}), mainModel });
+ { ...(mainTimeoutMs ? { mainTimeoutMs } : {}), mainModel: mainModel && !this._workflowReplayTabs?.has(tabId) });
pending.forEach((text, index) => {
if (readings[index]?.choice) this._pageTextReadings.set(this._pageTextKey(kind, text, context), readings[index].choice);
});
@@ -28824,12 +28824,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
|| !isVisible(control) || control.disabled || control.getAttribute('aria-disabled') === 'true'
|| control.matches('[formaction],[formmethod],[formtarget],[command],[commandfor],[onclick],[data-action]')
|| socialPublishControlEvidence(control).isSubmit || sendMarker(control)
- || commitReading(actionReading)) return false;
+ // A caption read as a publication, commit or deletion is never
+ // draft-local.
+ || commitReading(actionReading) || deletionReading(actionReading)) return false;
// A saved-record control cannot borrow an editor elsewhere on the page.
if (control.closest('article,[role="article"],[role="listitem"],[itemid]')) return false;
// Inside the editor, a control edits the draft unless its caption
- // reads as a deletion or as editing the draft (removing something).
- if (control.closest('[contenteditable="true"]') && !deletionReading(actionReading) && actionReading !== 'form_edit') return true;
+ // reads as editing the draft (removing something from it).
+ if (control.closest('[contenteditable="true"]') && actionReading !== 'form_edit') return true;
const toolbarDraft = (() => {
const toolbar = control.closest('[role="toolbar"]');
const root = toolbar?.closest('form,dialog,[role="dialog"],section,[role="region"]')
@@ -28839,9 +28841,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (editors.length !== 1) return false;
if (toolbar) {
const ids = String(toolbar.getAttribute('aria-controls') || control.getAttribute('aria-controls') || '').split(/\s+/).filter(Boolean);
- // The editor target proves a local formatting operation, but it
- // cannot turn a deletion caption into a formatting command.
- return !deletionReading(actionReading) && ids.length === 1 && doc.getElementById(ids[0]) === editors[0];
+ // The editor target proves a local formatting operation.
+ return ids.length === 1 && doc.getElementById(ids[0]) === editors[0];
}
const preview = control.closest('figure,[role="group"]');
const staged = [...root.querySelectorAll('input[type="file"]')].some(input => input.files?.length > 0);
@@ -28851,12 +28852,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (toolbarDraft) return true;
const composer = draftComposerFor(control);
if (!composer) return false;
- // A caption read as a deletion or as editing the draft removes or
- // changes an attachment only when the item is visibly one.
- if (deletionReading(actionReading) || actionReading === 'form_edit') {
- if (draftAttachmentEvidence(control, composer)) return true;
- if (deletionReading(actionReading)) return false;
- }
+ // A caption read as editing the draft removes or changes an
+ // attachment when the item is visibly one.
+ if (actionReading === 'form_edit' && draftAttachmentEvidence(control, composer)) return true;
// Other composer tools (emoji, media pickers, polls) are local only in
// an app-identified post composer; a generic "Add" or "Create" button
// beside a text field may itself be the commit.
@@ -29289,17 +29287,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return owner?.closest?.('button,input,[role="button"],[role="menuitem"],[role="menuitemradio"],[role="menuitemcheckbox"],[role="tab"],[role="option"],[role="treeitem"],[role="switch"],[role="checkbox"],[role="radio"],summary') || null;
};
const ordinaryControlEvidence = (ordinary, labels) => {
- const popupTarget = /^(?:true|menu|listbox|tree|grid|dialog)$/i.test(ordinary.getAttribute('aria-haspopup') || '')
- || ordinary.hasAttribute('popovertarget');
// An app's own control name decides publication capability on X and
// Bluesky (socialPublishControlEvidence). A non-publish test id
// disproves a caption read as a publication, such as Reply or
// Schedule post, while a caption read as a deletion, send, save or
- // payment still marks a commit. A popup launcher may name the post it
- // operates on; actual composer submits are identified above.
+ // payment still marks a commit. A popup launcher that only names the
+ // post it operates on ("Post actions") reads as opening a menu; one
+ // whose caption reads as publishing stays a commit.
const appNamedNonPublish = !!socialPublishAdapterName() && !!ordinary.getAttribute('data-testid') && !sendMarker(ordinary);
const captionChoice = captionsReading(labels);
- const consequential = popupTarget || appNamedNonPublish
+ const consequential = appNamedNonPublish
? captionChoice === 'commit' || deletionReading(captionChoice)
: commitReading(captionChoice) || deletionReading(captionChoice);
let uniqueTarget = true;
@@ -29359,11 +29356,12 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& target.closest?.('[data-testid="SideNav_NewTweet_Button"],[data-testid="FloatingActionButton"],[data-testid="composeFAB"],[data-testid="addButton"],[data-testid="attachments"],[data-testid="fileInput"],[data-testid="app-bar-back"],[data-testid="closeButton"]')) {
return { isSubmit: false, host, url, resolvedNonSubmitTarget: true };
}
- // A named button outside any form whose captions a model read as only
- // changing the view (closing, cancelling, going back), in any language,
- // is not a submit; app publish and send controls never are this.
+ // A dialog's named button outside any form whose captions a model read
+ // as only changing the view (closing, cancelling, going back), in any
+ // language, is not a submit; app publish and send controls never are this.
const viewButton = target?.closest?.('button');
if (viewButton && ['click', 'click_ax', 'iframe_click'].includes(toolName) && viewButton.hasAttribute('aria-label')
+ && viewButton.closest('dialog,[role="dialog"],[role="alertdialog"]')
&& !viewButton.form && !viewButton.closest('form') && !sendMarker(viewButton)
&& !socialPublishControlEvidence(viewButton).isSubmit && captionsReading(controlCaptions(viewButton)) === 'view') {
return { isSubmit: false, host, url, resolvedNonSubmitTarget: true };
@@ -37730,6 +37728,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
? runOptions?.parentSessionId || null
: null;
await this._claimRunEntry(tabId, 'workflow', runOptions);
+ // A deterministic replay asks no model: page texts its checks read are
+ // read by the decision model alone, if at all.
+ this._workflowReplayTabs ??= new Set();
+ this._workflowReplayTabs.add(tabId);
const feedbackRun = this._pageFeedbackRuns?.get(tabId);
if (feedbackRun) feedbackRun.onUpdate = onUpdate;
let completionRunToken = '';
@@ -37796,7 +37798,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
try {
await cdpClient.cleanupRun(tabId);
} catch { /* preserve the original setup failure */ }
- finally { this._releaseRunEntry(tabId); }
+ finally { this._workflowReplayTabs?.delete(tabId); this._releaseRunEntry(tabId); }
}
}
throw error;
@@ -38111,6 +38113,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
await cdpClient.cleanupRun(tabId);
} catch { /* the debugger may already be detached during teardown */ }
finally {
+ this._workflowReplayTabs?.delete(tabId);
this._releaseRunEntry(tabId);
}
}
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 79193d5d2..05be6c119 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -7263,7 +7263,7 @@ export class Agent extends LoopDetector {
.filter(text => !this._pageTextReadings.has(this._pageTextKey(kind, text, context)));
if (!pending.length) return;
const readings = await this._semanticDecisions(tabId, kind, { items: pending.map(text => ({ ...context, text })) },
- { ...(mainTimeoutMs ? { mainTimeoutMs } : {}), mainModel });
+ { ...(mainTimeoutMs ? { mainTimeoutMs } : {}), mainModel: mainModel && !this._workflowReplayTabs?.has(tabId) });
pending.forEach((text, index) => {
if (readings[index]?.choice) this._pageTextReadings.set(this._pageTextKey(kind, text, context), readings[index].choice);
});
@@ -26130,12 +26130,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
|| !isVisible(control) || control.disabled || control.getAttribute('aria-disabled') === 'true'
|| control.matches('[formaction],[formmethod],[formtarget],[command],[commandfor],[onclick],[data-action]')
|| socialPublishControlEvidence(control).isSubmit || sendMarker(control)
- || commitReading(actionReading)) return false;
+ // A caption read as a publication, commit or deletion is never
+ // draft-local.
+ || commitReading(actionReading) || deletionReading(actionReading)) return false;
// A saved-record control cannot borrow an editor elsewhere on the page.
if (control.closest('article,[role="article"],[role="listitem"],[itemid]')) return false;
// Inside the editor, a control edits the draft unless its caption
- // reads as a deletion or as editing the draft (removing something).
- if (control.closest('[contenteditable="true"]') && !deletionReading(actionReading) && actionReading !== 'form_edit') return true;
+ // reads as editing the draft (removing something from it).
+ if (control.closest('[contenteditable="true"]') && actionReading !== 'form_edit') return true;
const toolbarDraft = (() => {
const toolbar = control.closest('[role="toolbar"]');
const root = toolbar?.closest('form,dialog,[role="dialog"],section,[role="region"]')
@@ -26145,9 +26147,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (editors.length !== 1) return false;
if (toolbar) {
const ids = String(toolbar.getAttribute('aria-controls') || control.getAttribute('aria-controls') || '').split(/\s+/).filter(Boolean);
- // The editor target proves a local formatting operation, but it
- // cannot turn a deletion caption into a formatting command.
- return !deletionReading(actionReading) && ids.length === 1 && doc.getElementById(ids[0]) === editors[0];
+ // The editor target proves a local formatting operation.
+ return ids.length === 1 && doc.getElementById(ids[0]) === editors[0];
}
const preview = control.closest('figure,[role="group"]');
const staged = [...root.querySelectorAll('input[type="file"]')].some(input => input.files?.length > 0);
@@ -26157,12 +26158,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (toolbarDraft) return true;
const composer = draftComposerFor(control);
if (!composer) return false;
- // A caption read as a deletion or as editing the draft removes or
- // changes an attachment only when the item is visibly one.
- if (deletionReading(actionReading) || actionReading === 'form_edit') {
- if (draftAttachmentEvidence(control, composer)) return true;
- if (deletionReading(actionReading)) return false;
- }
+ // A caption read as editing the draft removes or changes an
+ // attachment when the item is visibly one.
+ if (actionReading === 'form_edit' && draftAttachmentEvidence(control, composer)) return true;
// Other composer tools (emoji, media pickers, polls) are local only in
// an app-identified post composer; a generic "Add" or "Create" button
// beside a text field may itself be the commit.
@@ -26595,17 +26593,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return owner?.closest?.('button,input,[role="button"],[role="menuitem"],[role="menuitemradio"],[role="menuitemcheckbox"],[role="tab"],[role="option"],[role="treeitem"],[role="switch"],[role="checkbox"],[role="radio"],summary') || null;
};
const ordinaryControlEvidence = (ordinary, labels) => {
- const popupTarget = /^(?:true|menu|listbox|tree|grid|dialog)$/i.test(ordinary.getAttribute('aria-haspopup') || '')
- || ordinary.hasAttribute('popovertarget');
// An app's own control name decides publication capability on X and
// Bluesky (socialPublishControlEvidence). A non-publish test id
// disproves a caption read as a publication, such as Reply or
// Schedule post, while a caption read as a deletion, send, save or
- // payment still marks a commit. A popup launcher may name the post it
- // operates on; actual composer submits are identified above.
+ // payment still marks a commit. A popup launcher that only names the
+ // post it operates on ("Post actions") reads as opening a menu; one
+ // whose caption reads as publishing stays a commit.
const appNamedNonPublish = !!socialPublishAdapterName() && !!ordinary.getAttribute('data-testid') && !sendMarker(ordinary);
const captionChoice = captionsReading(labels);
- const consequential = popupTarget || appNamedNonPublish
+ const consequential = appNamedNonPublish
? captionChoice === 'commit' || deletionReading(captionChoice)
: commitReading(captionChoice) || deletionReading(captionChoice);
let uniqueTarget = true;
@@ -26665,11 +26662,12 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& target.closest?.('[data-testid="SideNav_NewTweet_Button"],[data-testid="FloatingActionButton"],[data-testid="composeFAB"],[data-testid="addButton"],[data-testid="attachments"],[data-testid="fileInput"],[data-testid="app-bar-back"],[data-testid="closeButton"]')) {
return { isSubmit: false, host, url, resolvedNonSubmitTarget: true };
}
- // A named button outside any form whose captions a model read as only
- // changing the view (closing, cancelling, going back), in any language,
- // is not a submit; app publish and send controls never are this.
+ // A dialog's named button outside any form whose captions a model read
+ // as only changing the view (closing, cancelling, going back), in any
+ // language, is not a submit; app publish and send controls never are this.
const viewButton = target?.closest?.('button');
if (viewButton && ['click', 'click_ax', 'iframe_click'].includes(toolName) && viewButton.hasAttribute('aria-label')
+ && viewButton.closest('dialog,[role="dialog"],[role="alertdialog"]')
&& !viewButton.form && !viewButton.closest('form') && !sendMarker(viewButton)
&& !socialPublishControlEvidence(viewButton).isSubmit && captionsReading(controlCaptions(viewButton)) === 'view') {
return { isSubmit: false, host, url, resolvedNonSubmitTarget: true };
@@ -34359,6 +34357,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
? runOptions?.parentSessionId || null
: null;
await this._claimRunEntry(tabId, 'workflow', runOptions);
+ // A deterministic replay asks no model: page texts its checks read are
+ // read by the decision model alone, if at all.
+ this._workflowReplayTabs ??= new Set();
+ this._workflowReplayTabs.add(tabId);
const feedbackRun = this._pageFeedbackRuns?.get(tabId);
if (feedbackRun) feedbackRun.onUpdate = onUpdate;
let completionRunToken = '';
@@ -34410,6 +34412,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
try {
if (completionRunToken) this._clearCompletionInvariant(tabId, completionRunToken);
} finally {
+ this._workflowReplayTabs?.delete(tabId);
this._releaseRunEntry(tabId);
}
throw error;
@@ -34717,6 +34720,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
try {
this._clearCompletionInvariant(tabId, completionRunToken);
} finally {
+ this._workflowReplayTabs?.delete(tabId);
this._releaseRunEntry(tabId);
}
}
diff --git a/test/control-effect-readings.mjs b/test/control-effect-readings.mjs
index 09e50071e..e428a6046 100644
--- a/test/control-effect-readings.mjs
+++ b/test/control-effect-readings.mjs
@@ -15,6 +15,20 @@ for (const build of ['chrome', 'firefox']) {
const { Agent } = await import(`../src/${build}/src/agent/agent.js`);
const { guardRecentSubmitClick } = await import(`../src/${build}/src/agent/submit-click-guard.js`);
+ test(`${build}: a saved-workflow replay reads page texts with the decision model alone`, async () => {
+ const agent = new Agent({ getActive: () => ({}) });
+ const mainModel = [];
+ agent._semanticDecisions = async (_tab, _kind, { items = [] } = {}, options = {}) => {
+ mainModel.push(options.mainModel);
+ return items.map(() => ({ choice: 'view', evidence: '', source: 'decision_model' }));
+ };
+ await agent._readPageTexts(7, 'control_effect', ['Kapat'], {}, { maxChars: 200 });
+ // The tab a deterministic replay runs in asks no active model.
+ agent._workflowReplayTabs = new Set([8]);
+ await agent._readPageTexts(8, 'control_effect', ['Pencereyi kapat'], {}, { maxChars: 200 });
+ assert.deepEqual(mainModel, [true, false]);
+ });
+
test(`${build}: a rapid repeat is blocked only for a caption a model read as a commit, in any language`, async () => {
const page = 'https://shop.example.test/sepet';
for (const [caption, blocked] of [['Kaydet', true], ['Onayla', true], ['Gönder', true], ['送信', true],
diff --git a/test/semantic-decision-stub.mjs b/test/semantic-decision-stub.mjs
index dfed4fad0..2edce4af8 100644
--- a/test/semantic-decision-stub.mjs
+++ b/test/semantic-decision-stub.mjs
@@ -207,6 +207,9 @@ export function fixtureControlEffectReading(text) {
const has = words => new RegExp(`${WORD}(?:${words})${WEND}`, 'iu').test(value);
const hasCjk = /ćˆ é™€|ćˆȘ陀|扊陀|삭제|送信|揑送|癌送|볮낮/u.test(value);
if (/^(?:compose(?: new)? post|new post|new message|cancel|keep editing|close|back|open|show more|more|menu|settings)$/i.test(value)) return 'view';
+ // "More 
", "Menu 
" and "
 actions" buttons open a menu, whatever they
+ // name.
+ if (/^(?:more|menu|options)\s/i.test(value) || /\s(?:actions|options|menu)$/i.test(value)) return 'view';
if (has('remove|clear|kaldır|temizle') && has('filters?|filtre\\p{L}*|filtro\\p{L}*|Ń„ĐžĐ»ŃŒŃ‚Ń€\\p{L}*|facets?|sort(?:ing)?|search(?:es)?|quer(?:y|ies)|selection|formatting')
&& !has('delete|trash|erase|destroy|sil|supprimer|eliminar|borrar|löschen|ŃƒĐŽĐ°Đ»ĐžŃ‚ŃŒ')) return 'view';
if (has(DELETE_WORDS) || /ćˆ é™€|ćˆȘ陀|扊陀|삭제/u.test(value)) {
diff --git a/test/submit-probe-readings.mjs b/test/submit-probe-readings.mjs
index 67ffca495..1a6d64b46 100644
--- a/test/submit-probe-readings.mjs
+++ b/test/submit-probe-readings.mjs
@@ -15,7 +15,7 @@ import { fixtureControlEffectReading, probeWithReadings, stubPageTextReadings }
const READINGS = {
TörlĂ©s: 'delete_one', 'FiĂłk törlĂ©se': 'delete_one', 'Összes törlĂ©se': 'delete_many', 'SzƱrƑ eltĂĄvolĂ­tĂĄsa': 'view',
'MellĂ©klet eltĂĄvolĂ­tĂĄsa': 'form_edit', KözzĂ©tĂ©tel: 'publish', KĂŒldĂ©s: 'commit', MentĂ©s: 'commit', BezĂĄrĂĄs: 'view',
- 'TĂŒmĂŒnĂŒ sil': 'delete_many', 'Mavi TiĆŸĂ¶rt': 'unclear',
+ 'TĂŒmĂŒnĂŒ sil': 'delete_many', 'Mavi TiĆŸĂ¶rt': 'unclear', 'BejegyzĂ©s mƱveletei': 'view',
};
const read = caption => READINGS[caption] ?? fixtureControlEffectReading(caption);
const pageUrl = 'https://shop.example/cart';
@@ -66,6 +66,25 @@ for (const build of ['chrome', 'firefox']) {
assert.equal((await probe('#t')).resolvedDraftControl, true, 'a removed file shown beside the draft is a draft edit');
});
+ await t.test('a launcher read as publishing, a deletion beside a draft file and a view button outside a dialog keep their checks', async () => {
+ // A menu launcher whose caption reads as publishing is a commit; one
+ // that names the post its menu acts on only opens the menu.
+ await open('<article><p>BejegyzĂ©s</p><button id="t" type="button" aria-haspopup="menu" aria-label="KözzĂ©tĂ©tel">
</button></article>');
+ assert.notEqual((await probe('#t'))?.resolvedOrdinaryActivationTarget, true, 'a publishing launcher');
+ await open('<article><p>BejegyzĂ©s</p><button id="t" type="button" aria-haspopup="menu" aria-label="BejegyzĂ©s mƱveletei">
</button></article>');
+ assert.equal((await probe('#t')).resolvedOrdinaryActivationTarget, true, 'a post menu launcher');
+ // A caption read as a deletion is no draft edit, even beside a file.
+ await open('<section><textarea aria-label="Üzenet">Szia</textarea><div class="attachment"><span>jelentes.pdf</span>'
+ + '<button id="t" type="button">TörlĂ©s</button></div><button type="button">KĂŒldĂ©s</button></section>');
+ assert.notEqual((await probe('#t')).resolvedDraftControl, true, 'a deletion beside a draft file');
+ // A named button read as only changing the view is a non-submit in a
+ // dialog, and an ordinary control elsewhere.
+ await open('<div role="dialog"><p>SzƱrƑk</p><button id="t" type="button" aria-label="BezĂĄrĂĄs">×</button></div>');
+ assert.equal((await probe('#t')).resolvedNonSubmitTarget, true, 'a dialog view button');
+ await open('<div class="chips"><button id="t" type="button" aria-label="SzƱrƑ eltĂĄvolĂ­tĂĄsa">L ×</button></div>');
+ assert.equal((await probe('#t')).resolvedOrdinaryActivationTarget, true, 'a filter chip');
+ });
+
await t.test('commit and publication captions keep their checks; a composer tool read as a commit is not a draft tool', async () => {
await open('<section><textarea aria-label="Üzenet">Szia</textarea><button id="t" type="button">KĂŒldĂ©s</button></section>');
let result = await probe('#t');
@@ -79,7 +98,7 @@ for (const build of ['chrome', 'firefox']) {
await open('<button id="t" type="button">BezĂĄrĂĄs</button>');
assert.equal((await probe('#t')).resolvedOrdinaryActivationTarget, true);
await open('<button id="t" type="button" aria-label="Bezárás">×</button>');
- assert.equal((await probe('#t')).resolvedNonSubmitTarget, true, 'a named button read as closing');
+ assert.equal((await probe('#t')).resolvedOrdinaryActivationTarget, true, 'a named button read as closing');
});
await t.test('the collect pass reports unread captions before changing the page, and an unread caption decides nothing', async () => {