`useKeyHold` / `KeyStateTracker` latches a modifier forever when a `keyup` is swallowed without a `blur` (e.g. macOS Cmd+Shift+4)
メンテナーはふだん 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
- Render anything using
const shift = useKeyHold('Shift'). - On macOS, focus the page and press Cmd+Shift+4 (screenshot-to-selection).
- Press Esc to cancel (or take the shot).
- Observe
useKeyHold('Shift')is now stuck attrue, 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/hotkeys のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
TanStack/hotkeys#105 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
TanStack/hotkeys#142 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
TanStack/hotkeys#138 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Dependency Dashboardオープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
TanStack/hotkeys の issue をすべて見る
似ている issue
-
triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mermaid-js/mermaid-live-editor#2053 ·
メンテナーはふだん 1 日以内に返信
-
factory
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
jessepollak/home#1455 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
lingdojo/kana-dojo#31227 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
appandflow/stim#1838 ·
メンテナーはふだん 1 日以内に返信