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

AltGr characters fire unmodified hotkeys on the same physical key

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

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

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

評価

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

調査の方向性

_match.ts から着手する:modifiersMatch(86-87 行目、altGraph の下で Ctrl/Alt をクリアする処理)、53 行目のラテン文字ガード、60-64 行目の code フォールバック、そして 30 行目の Ctrl/Alt ホットキーをすでに処理している直接的な key 経路を読む。AltGr によって生成された文字が物理キーのフォールバックをスキップすべき箇所を決定し、その後、パッケージのテストスイートと issue の 3 つの再現ケースを実行する(いずれも false を返すべき)。完了の意味は、AltGr の押下がマッチしなくなる一方で、既存のホットキーマッチングテストが引き続き通ることである。

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

説明

Describe the bug

On layouts with AltGr (German, Polish, …), typing an AltGr character fires an unmodified single-key hotkey on the same physical key.

  • German AltGr+M types µ and fires a M hotkey.
  • Polish AltGr+C types ć and fires a C hotkey.
  • German AltGr+Q types @ and fires a Q hotkey.

In _match.ts, modifiersMatch clears Ctrl and Alt when altGraph is set (lines 86–87). The code fallback (lines 60–64) then maps KeyM → M, which matches. For ć, the Latin-letter guard at line 53 is skipped because normalized.alt is true under AltGr. µ and @ aren't Latin letters, so the guard doesn't apply at all.

Reproduce
import { matchesKeyboardEvent } from '@tanstack/hotkeys'

// What Chrome on Windows reports for AltGr+<key>: Ctrl+Alt plus the AltGraph modifier state.
const altGr = (key: string, code: string) =>
  ({ type: 'keydown', key, code, ctrlKey: true, altKey: true, shiftKey: false, metaKey: false,
     isComposing: false, getModifierState: (k: string) => k === 'AltGraph' }) as unknown as KeyboardEvent

matchesKeyboardEvent(altGr('µ', 'KeyM'), 'M', 'windows') // true, expected false
matchesKeyboardEvent(altGr('ć', 'KeyC'), 'C', 'windows') // true, expected false
matchesKeyboardEvent(altGr('@', 'KeyQ'), 'Q', 'windows') // true, expected false
Expected

A key press that produced a character through AltGr is text input and should not fall back to the physical key. Only a direct key match should count, as line 30 already does for hotkeys with Ctrl/Alt.

Versions

@tanstack/hotkeys 0.11.0 and @tanstack/react-hotkeys 0.13.0. _match.ts on main still has the same code.

主要言語
TypeScript
スター
738
フォーク
48
平均マージ
16時間 23分
マージ済み PR(30日)
11

環境構築

はじめの一歩

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

TanStack/hotkeys のほかの issue

TanStack/hotkeys の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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