Skip to content

#358 🧊 [bug] : hook useKeyboard #358#407

Open
bndby wants to merge 1 commit intosiberiacancode:mainfrom
bndby:#358
Open

#358 🧊 [bug] : hook useKeyboard #358#407
bndby wants to merge 1 commit intosiberiacancode:mainfrom
bndby:#358

Conversation

@bndby
Copy link
Contributor

@bndby bndby commented Aug 23, 2025

fix bug in demo


const Demo = () => {
const [pressedKeys, setPressedKeys] = useState<string[]>([]);
// Use object to track both key (character) and code (physical key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you add these comments?

setPressedKeys((prevPressedKeys) => {
if (!prevPressedKeys.includes(event.key)) {
return [...prevPressedKeys, event.key];
// Check by event.code (physical key), not by event.key (character)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants