Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

AltGr characters fire unmodified hotkeys on the same physical key

Open Beginner friendly
#169 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Start in _match.ts: read modifiersMatch (lines 86-87 clearing Ctrl/Alt under altGraph), the Latin-letter guard at line 53, the code fallback at lines 60-64, and the direct-key path at line 30 that already handles Ctrl/Alt hotkeys. Decide where an AltGr-produced character should skip the physical-key fallback, then run the package test suite plus the three repro cases from the issue (they should all return false). Done means AltGr presses no longer match while existing hotkey-matching tests still pass.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
738
Forks
48
Avg merge
16h 23m
Merged PRs (30d)
11

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TanStack/hotkeys

All issues in TanStack/hotkeys

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.