[Bug]: ariaSnapshot({ mode: 'ai' }) drops the name of dialogs, landmarks, tables and column headers when it comes from a visible descendant
Los mantenedores suelen responder en 1 día
@microsoft-playwright-automation ya está trabajando en esto.
Desde el 30/10/2026.
- #43810 de @microsoft-playwright-automation — abierto
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- html, typescript
- Área
- testing-qa
Línea de trabajo
Start with removeRedundantNames in packages/injected/src/ariaSnapshotDistiller.ts and the existing AR-060 case in tests/page/page-aria-snapshot-ai.spec.ts; compare how names from visible descendants are handled. Use the reported repro cases to check the behavior across container roles. Done means container names remain available in AI-mode snapshots without changing AR-060's expected behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version
1.64.1 (latest release; the same code is on main)
Steps to reproduce
- Clone https://github.com/Meet-Pansuriya/playwright-ai-snapshot-names-repro
npm ci && npx playwright install chromium webkitnpm run repro(Playwright Test, public API:ariaSnapshot({ mode: 'ai' })vs default mode; 10 cases: 5 where the name is kept, 5 where it's dropped; Chromium + WebKit)- Optional:
npm run repro:clishows the same throughnpx playwright cli snapshot
Minimal version of the failing case:
test('AI-mode snapshot keeps a container name that comes from a visible descendant', async ({ page }) => {
await page.setContent(`<main>
<dialog open aria-labelledby="t"><h2 id="t">Delete item?</h2><button>OK</button></dialog>
<table><caption>Monthly totals</caption><tr><td>1</td></tr></table>
</main>`);
await expect(page.getByRole('dialog', { name: 'Delete item?' })).toHaveCount(1); // passes
expect(await page.locator('main').ariaSnapshot()).toContain('dialog "Delete item?"'); // passes
const ai = await page.locator('main').ariaSnapshot({ mode: 'ai' });
expect(ai).toContain('dialog "Delete item?"'); // fails: "- dialog [ref=e2]:"
expect(ai).toContain('table "Monthly totals"'); // fails: "- table [ref=e5]:"
});
Expected behavior
The AI-mode snapshot prints the accessible name of containers whose name identifies them, as default mode does: dialog "Delete item?", navigation "Nav E", columnheader "Price", table "Monthly totals".
Actual behavior
The name is dropped whenever every element contributing it is printed as a descendant (identical on Chromium and WebKit):
| Name source | AI mode |
|---|---|
aria-label; aria-labelledby → element outside; → hidden element |
kept |
aria-labelledby → visible heading inside a region / navigation / dialog |
dropped |
a button inside a columnheader (sortable header) |
dropped |
<caption> inside a <table> |
dropped |
<legend> in <fieldset>, <figcaption> in <figure> |
kept |
AI-mode output for the minimal case above:
- main [ref=e1]:
- dialog [ref=e2]:
- heading "Delete item?" [level=2] [ref=e3]
- button "OK" [ref=e4]
- table [ref=e5]:
- caption [ref=e6]: Monthly totals
- rowgroup [ref=e7]:
- row [ref=e8]:
- cell "1" [ref=e9]
getByRole(role, { name }) finds every one of these elements, and ariaSnapshot() in default mode prints every name.
Additional context
This comes from removeRedundantNames in packages/injected/src/ariaSnapshotDistiller.ts (aiPlugins), which clears node.name when all of nameFromContentRefs are rendered below. That's intended for cases like AR-060 in tests/page/page-aria-snapshot-ai.spec.ts (a heading whose name repeats its link), and this issue doesn't ask to change that. But the rule ignores the role: for containers the name is the identifier people and agents use (getByRole('dialog', { name }), getByRole('columnheader', { name })), and the contributing heading or caption is printed as an ordinary child with nothing linking it to the container.
Why it matters: agents read playwright-cli snapshot / browser_snapshot to choose locators. With the name gone they concluded dialogs and landmarks had no accessible name, reported false accessibility issues, and fell back to locator('dialog'), which then hit strict-mode violations on a page with several dialogs.
Possible fix: skip the removal for roles whose name identifies a container (dialog, alertdialog, region, navigation, main, complementary, form, search, group, table, grid, treegrid, columnheader, rowheader, tabpanel…), or replace it with a short marker such as dialog "Delete item?" (from heading). Either keeps AR-060 as it is.
Related but different: #41985 (fixed by #41988). No existing report found for this case.
Environment
System:
OS: macOS 27.2
CPU: (8) arm64 Apple M1
Memory: 16 GB
Binaries:
Node: 22.14.0
npm: 10.9.2
npmPackages:
@playwright/test: 1.64.1 => 1.64.1
Browsers (Playwright):
chromium: 156.0.8078.4
webkit: 27.2
- Lenguaje dominante
- TypeScript
- Estrellas
- 98.5k
- Forks
- 6.7k
- Merge medio
- 17 h 5 min
- PR fusionados (30 d)
- 326
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/playwright
-
[Feature]: Node 26 Docker ImagesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/playwright#43759 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/playwright#43741 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 1/100
microsoft/playwright#43813 · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
[Feature]: Opt-in way to keep the worker and its worker-scoped fixtures alive after a test failureAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/playwright#43811 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
microsoft/playwright#43797 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/playwright
Issues similares
-
Add: Disco Mix SDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
level2 nsoc26
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
GauravKarakoti/SecureFlow#1488 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
deltachat/deltachat-desktop#6914 ·
Los mantenedores suelen responder en 2 días
-
area:cli bug P4
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug from-studio
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
esengine/DeepSeek-Reasonix#14868 ·
Los mantenedores suelen responder en 1 día