Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug]: fill() on a paragraph inside a contenteditable body in an iframe resolves but inserts nothing

Abierto
#43,483 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@yury-s ya está trabajando en esto.

Desde el 16/10/2026.

  • #43487 de @yury-s — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
typescript
Área
testing

Línea de trabajo

Start by reproducing the report with the snippet in the issue, using Chrome in headless mode, and note that fill() succeeds while the <p> text never changes. The issue points to focus handling: fill() should focus the nearest [contenteditable] ancestor when the target is not focusable, as it does for inputs. Check the already-open pull request #43487 first, since someone is working on this. Done means the reproduction passes and the <p> inside an iframe's <body contenteditable> is filled.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version

1.63.0

Steps to reproduce
import { test, expect } from '@playwright/test';

test('fill a paragraph of an editor in an iframe', async ({ page }) => {
  await page.setContent(`<iframe srcdoc="<body contenteditable><p id=p>old</p></body>"></iframe>`);
  const frame = page.frames()[1];
  await frame.locator('#p').waitFor();
  await frame.locator('#p').fill('new');   // resolves without error
  await expect(frame.locator('#p')).toHaveText('new');   // fails: still "old"
});
Expected behavior

fill() replaces the paragraph's text with new, or throws.

Actual behavior

fill() resolves, and nothing is inserted anywhere: the paragraph keeps old.

The target is editable (isContentEditable is inherited from the <body contenteditable>), but it is not focusable itself, and its frame's document does not have focus, so the inserted text goes to whichever document has focus. Observations:

  • frame.locator('body').fill('new') works (the editing host is focused).
  • Focusing the editing host first makes the paragraph fill work: await frame.locator('#p').evaluate(el => el.closest('[contenteditable]').focus()).
  • The same happens in the top page when another frame has focus: a <p> inside <div contenteditable> is not filled while an iframe's document is focused.
  • Seen on a real editor: the TinyMCE demo at https://the-internet.herokuapp.com/iframe (its <p> inside the editor frame).

Perhaps fill() could focus the element's editing host (the nearest [contenteditable] ancestor) when the target itself is not focusable, as it focuses inputs. Possibly related, but a different cause (an editor's focus handler): #39492.

Additional context

We work around it in a tool built on Playwright by focusing the nearest editing host before fill().

Environment
  • Playwright (playwright-core) 1.63.0, Node.js 24.21.0
  • Google Chrome 155.0.8059.80 (channel: 'chrome'), headless
  • macOS 27 (arm64)
Lenguaje dominante
TypeScript
Estrellas
97.4k
Forks
6.6k
Merge medio
18 h 15 min
PR fusionados (30 d)
318

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/playwright

Todos los issues de microsoft/playwright

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.