[Bug]: fill() on a paragraph inside a contenteditable body in an iframe resolves but inserts nothing
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- testing
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- TypeScript
- Stelle
- 97.4k
- Fork
- 6.6k
- Merge medio
- 18h 15m
- PR unite (30g)
- 318
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/playwright
-
[Feature]: Set `this.name` in `TargetClosedError` constructorForse di nuovo libera @LeonxLJX l’ha presa 42 giorni fa e non c’è nessuna pull request aperta. ApertaP3-collecting-feedback
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
microsoft/playwright#42522 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: ariaSnapshot() emits \uXXXX / \b escapes in role names that toMatchAriaSnapshot() parses back incorrectlyForse già presa @alok-108 l’ha presa oggi. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 22/100
microsoft/playwright#43489 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Chromium – locale is not applied to Accept-Language / navigator.languages inside dedicated WorkersForse già presa @yury-s l’ha presa oggi. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 25/100
microsoft/playwright#43484 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Python sync API logs CancelledError when exiting sync_playwright() with an unanswered routeForse già presa @yury-s l’ha presa oggi. Aperta
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 18/100
microsoft/playwright#43463 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: macOS WebKit reports `dropEffect: 'copy'` on dragend for `copyMove` when the drop target doesn't set `dropEffect`Forse già presa @yury-s l’ha presa oggi. Apertabrowser-webkit v1.65
microsoft/playwright#43447 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/playwright
Issue simili
-
`cf complete zsh >> .zshrc` fails on vanilla zshForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
cloudflare/cf#340 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Rename Madson cameraAperta
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 75/100
StoDevX/AAO-React-Native#8785 ·
I maintainer di solito rispondono entro 1 giorno
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commitForse già presa @myOmikron l’ha presa oggi. Apertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100