Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AltGr characters fire unmodified hotkeys on the same physical key

Aperta Adatta ai principianti
#169 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@dasjideepak ci sta già lavorando.

Dal 15/10/2026.

  • #177 di @dasjideepak — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia in _match.ts: leggi modifiersMatch (righe 86-87 che azzerano Ctrl/Alt sotto altGraph), il controllo sulle lettere latine alla riga 53, il fallback di code alle righe 60-64 e il percorso diretto tramite key alla riga 30, che gestisce già gli hotkey con Ctrl/Alt. Decidi in quale punto un carattere prodotto da AltGr debba saltare il fallback sulla tastiera fisica, quindi esegui la suite di test del package più i tre casi di riproduzione dell'issue (tutti e tre devono restituire false). Per completare si intende che le pressioni di AltGr non corrispondono più, mentre i test esistenti di hotkey-matching continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
738
Fork
48
Merge medio
4h 4m
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/hotkeys

Tutte le issue di TanStack/hotkeys

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.