TanStack / TanStack/hotkeys

`useKeyHold` keeps returning `true` when devTools is open in some cases

Open
#66 0 comments 0 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.4.1

Framework/Library version

React v19.2.3

Describe the bug and the steps to reproduce it

Granted, this is a niche use case. The bug mostly affect developers, not end users.

Steps to reproduce
Image
  • Do not close the DevTools. Click anywhere on the page
  • Trigger the devTools' keyboard shortcut to inspect a DOM element (on a Mac: Cmd+Shift+I)
  • (Optional) Click any element on the page
Expected result

The Meta and Shift keys appear as "Released"

Image
Actual result

The Meta and Shift keys keep appearing as "HELD"

Image
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/github/tanstack/hotkeys/tree/main/examples/react/useKeyhold?embed=1&file=%2Fsrc%2Findex.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not have time to dig into it

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

Reproduce the behavior using the linked CodeSandbox and the React useKeyhold example at examples/react/useKeyhold, with Chrome DevTools' “Emulate a focused page” enabled. Trace how the Meta and Shift states are updated after the DevTools inspection shortcut; done means useKeyHold reports both keys as Released instead of Held.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.