[Bug]: Firefox fires `cancel` on a file input before `change` when a FileChooser's `setFiles` is called (1.65.0)

オープン
#43,994 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
playwright, typescript
領域
testing-qa

調査の方向性

Start by tracing how Firefox handles FileChooser.setFiles and dispatches file input events; the issue provides a JavaScript reproduction but names no source files or tests. Run the reproduction against Firefox and confirm the current event order. Done when cancel no longer fires before input and change for a programmatic file selection, while genuine cancellation behavior remains correct.

索引モデルが issue の本文から書いたものです。

説明

Version

1.65.0 (Firefox 159.0, revision 1572). Not in 1.64.1 (revision 1555).

Steps to reproduce
import { firefox } from 'playwright';

const browser = await firefox.launch();
const page = await browser.newPage();
page.on('console', (m) => console.log(m.text()));
await page.setContent(`<button onclick="
	const i = document.createElement('input'); i.type = 'file';
	for (const e of ['cancel', 'input', 'change']) i.addEventListener(e, () => console.log(e, i.files.length));
	i.click();">open</button>`);
const [chooser] = await Promise.all([page.waitForEvent('filechooser'), page.click('button')]);
await chooser.setFiles('some-file.txt');
await page.waitForTimeout(1000);
await browser.close();
Expected behavior

As with 1.64.1, and with Chromium in 1.65.0:

input 1
change 1
Actual behavior
cancel 0
input 1
change 1

cancel arrives about 60 ms before input and change, with no files. Code that resolves a promise on the first of change and cancel takes the choice as cancelled. That's a common pattern for a file input that isn't attached to the document.

Additional context

A user choosing a file in Firefox gets no cancel, and the HTML spec fires cancel only when the selection is cancelled or unchanged. We pinned 1.64.1 for now.

Environment

macOS (arm64), Node.js 24.16.0, also on GitHub's macOS runners.

主要言語
TypeScript
スター
99.1k
フォーク
6.8k
平均マージ
16時間 56分
マージ済み PR(30日)
299

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。