Angular (zoneless): `enabled` is applied in an effect, so a key matched before the next change detection sees the old value
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- angular, typescript
- 領域
- frontend
調査の方向性
Start with the Angular adapter's injectHotkeys implementation and trace how enabled reaches the hotkey manager's #isLive matching path. Use the linked StackBlitz reproduction to compare nested-scope behavior when enabled changes before another keydown. Done means the inner handler stops running after its scope is disabled and the parent handles subsequent keys; check whether a fix affects other adapters or core behavior.
索引モデルが issue の本文から書いたものです。
説明
TanStack Hotkeys version
@tanstack/angular-hotkeys 0.25.2 (@tanstack/hotkeys 0.33.0)
Framework/Library version
Angular 22.2.3
Describe the bug and the steps to reproduce it
injectHotkeys applies a reactive enabled from an Angular effect, so the manager only sees the new value after the next change detection. A key that arrives before then is matched against the old value. When one handler disables a nested scope, the next key runs that scope's handler instead of falling through to the parent.
Hand-typed keys usually leave time for change detection, so this mostly shows with programmatic events and automated tests. This is not #105 (callback form to avoid re-registration). The issue is when enabled is read, not how often the registration is updated.
Example: nested scopes bind ArrowDown. The inner one moves a row while row < 4, the outer one logs a "cross". Eight presses should give four moves, then four crosses.
Steps (fail every run in Chromium and Firefox):
- Click "Set row to 4, then one keydown, in one task". Expected
cross at 4, actualmove from 4. - Click Reset, then "Dispatch 8 keydowns in one task". Expected 4 moves then 4 crosses, actual 8 moves.
Runs that gave the expected log, of 20 (Playwright 1.64.1, Chromium 156, Firefox 157):
| Input | Chromium | Firefox |
|---|---|---|
| Steps 1 and 2 | 0 | 0 |
Eight keyboard.press |
1 | 20 |
Eight keyboard.down (held) |
0 | 20 |
Workaround: a capture-phase keydown listener on an ancestor that calls ApplicationRef.tick().
Possible fixes (ideas only, not checked against other adapters or the core):
enabled?: boolean | (() => boolean), read when the key is matched (#isLive).- A hook that runs before matching, so an adapter can flush pending effects.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/stackblitz-starters-xxhahcn7
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging
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
- スター
- 761
- フォーク
- 50
- 平均マージ
- 6時間 51分
- マージ済み PR(30日)
- 68
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/hotkeys のほかの issue
-
Dependency Dashboardオープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
TanStack/hotkeys の issue をすべて見る
似ている issue
-
inference/go type/feature
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#65148 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
truapi-release
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
paritytech/product-sdk#529 ·
メンテナーはふだん 1 日以内に返信
-
Add: Mansudae TVオープンapproved check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
devlikeapro/waha#2369 ·
メンテナーはふだん 5 日以内に返信