TanStack / TanStack/hotkeys

+, _, ;, Mod++, and a few other combo keys are unsupported

Open
#33 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
719
Forks
47
Avg merge
5d 5h
Merged PRs (30d)
1

Description

TanStack Hotkeys version

v0.1.3

Framework/Library version

React v18.3.1

Describe the bug and the steps to reproduce it
// these work
useHotkey("=", () => {});
useHotkey("-", () => {});

// none of these work
useHotkey("+", () => {});
useHotkey("Mod++", () => {});
useHotkey("Mod+Shift+=", () => {});
useHotkey("_", () => {});
useHotkey("Mod+_", () => {});
useHotkey("Mod+Shift+-", () => {});

It should be possible to register these, although I assume Mod++ will prove tricky since + is used in the template literal types for chaining. But Mod+Shift+= does not work either.

We would like to use Mod+Shift+= and Mod+Shift+- in our code base.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/github/AleksandrHovhannisyan/useHotkey-bug-report/main?file=%2Fsrc%2Findex.tsx&workspaceId=ws_EYV7eQpntkPhtWonNS8z6x

Screenshots or Videos (Optional)
TypeScript error when trying to use the useHotkey hook with Mod++. Message: Argument of type 'Mod++' is not assignable to parameter of type 'RegisterableHotkey'
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.

Contributor guide

Open the contributing guide

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.

Research direction

Start with the linked CodeSandbox and trace useHotkey through the RegisterableHotkey type and registration path. Check how literal combinations containing +, _, and shifted symbols are parsed and accepted. Done means the reported examples compile and register their corresponding shortcuts, including Mod+Shift+= and Mod+Shift+-.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.