fix(input): keys and mouse buttons stay held after alt-tab or a release outside the container

オープン 初心者向け
#481 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

modules/input/src/keyboard-mouse/input-handler.tsの47〜54行目付近と、modules/input/test/keyboard-mouse/input.library.spec.tsの171〜181行目付近にある回帰テストを読みます。destroyでハンドラーがどのように登録・削除されるかを確認し、input libraryのテストを実行します。完了条件は、コンテナーとウィンドウそれぞれのモックで、フォーカス喪失、表示状態の変更、コンテナー外でのマウスボタン解放時にキーとマウスの状態がリセットされることを検証できることです。

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

説明

bug modules:input tests
Which package is this bug report for?

input

Issue description

visibilitychange only fires on document, and blur does not bubble to a non-focusable div, so the reset handlers registered on the container never run. Holding W and alt-tabbing leaves KeyW true. A mouseup outside the container leaves the drag and the button state set. The unit test passes only because its mock container is the window mock (input.library.spec.ts:49-52).

Where:

Evidence:

container.addEventListener("mouseup", this.onMouseUp);
container.addEventListener("blur", this.onBlur);
container.addEventListener("visibilitychange", this.onVisibilityChange);

Suggested fix: Listen for blur and mouseup on window and for visibilitychange on container.ownerDocument, and remove them in destroy. Give the test a container mock that is not the window.

Found during a code audit of main at be72076.

Code sample

No response

Versions
  • Engine main at be72076
  • pnpm 12.0.0, Node.js 26, Bun 1.3.14
Issue priority

High (immediate attention needed)

I have tested this issue on a development release

be72076

主要言語
TypeScript
スター
7
フォーク
2
平均マージ
1日 17時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

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

NanoForge-dev/Engine のほかの issue

NanoForge-dev/Engine の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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