Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`useKeyHold` / `KeyStateTracker` latches a modifier forever when a `keyup` is swallowed without a `blur` (e.g. macOS Cmd+Shift+4)

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
frontend

調査の方向性

useKeyHold エントリーポイントと KeyStateTracker のグローバルな動作から始め、macOS 上で Cmd+Shift+4 を使ってリンク先の CodeSandbox で問題を再現します。window blur が発生しない場合に tracker が取りこぼされた keyup イベントをどのように処理するかを調査します。ショートカットがキャンセルまたは完了した後、別の物理的なキー入力を必要とせずに useKeyHold('Shift') が false を返せば完了です。

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

説明

TanStack Hotkeys version

10.0.0

Framework/Library version

React v19.2.0

Describe the bug and the steps to reproduce it

useKeyHold('Shift') (and every consumer of the global KeyStateTracker) can get permanently stuck reporting a modifier as held. The tracker only learns a key was released from a discrete keyup event, and its only recovery path for a missed keyup is a window blur. Any OS-level interaction that swallows the keyup without blurring the browser window strands the held state indefinitely — every subsequent useKeyHold read returns true until the user physically taps and releases that key again.

Reproduction

  1. Render anything using const shift = useKeyHold('Shift').
  2. On macOS, focus the page and press Cmd+Shift+4 (screenshot-to-selection).
  3. Press Esc to cancel (or take the shot).
  4. Observe useKeyHold('Shift') is now stuck at true, even though nothing is held.

Other triggers in the same class: Spotlight (Cmd+Space), Mission Control, and various OS shortcuts that consume a modifier keyup while leaving the browser window focused.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/sandbox/stoic-fast-h5k2pr

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not have time to dig into it

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
主要言語
TypeScript
スター
729
フォーク
47
平均マージ
18時間 46分
マージ済み PR(30日)
9

環境構築

はじめの一歩

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

TanStack/hotkeys のほかの issue

TanStack/hotkeys の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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