Skip to content

feat: add keyboard shortcuts and hints for RPS, Number Guessing and H…#575

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
avzuha:feat/keyboard-shortcuts
May 22, 2026
Merged

feat: add keyboard shortcuts and hints for RPS, Number Guessing and H…#575
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
avzuha:feat/keyboard-shortcuts

Conversation

@avzuha
Copy link
Copy Markdown
Contributor

@avzuha avzuha commented May 22, 2026

…angman

Related issue: #543
What this does:
Adds keyboard shortcut support across three game projects, making them faster to play and more accessible without relying entirely on mouse clicks. A visible hint is shown below each game's controls so users know shortcuts are available.

Changes per file:

rock-paper-scissor.js
R → Rock, P → Paper, S → Scissors
Brief button highlight animation when a key is pressed for visual feedback
MutationObserver cleans up the keydown listener when modal closes
Hint: ⌨️ Press R Rock · P Paper · S Scissors

number-guessing.js
Changed deprecated keypress → keydown
Input auto-focuses on load and after reset so Enter works immediately without clicking first
Hint: ⌨️ Press Enter to submit your guess

hangman.js
Changed deprecated keypress → keydown
Physical key press flashes the matching on-screen letter button for visual feedback
Guard added so typing in other inputs doesn't accidentally trigger guesses
MutationObserver cleans up listener when modal closes
Hint: ⌨️ Type any letter key to guess directly

Screenshots:
Screenshot 2026-05-22 113224
Screenshot 2026-05-22 113430
Screenshot 2026-05-22 113549

Suggested labels: enhancement, ui/ux, gssoc26

📋 Contribution Checklist

  • My code strictly adheres to the project guidelines (Standard library only, procedural code, clean spacing).
  • I have verified that my files are placed in the correct directory.
  • I have tested my changes thoroughly on my local machine.
  • I have included interactive emojis and clean console/UI outputs.
  • GSSoC 2026: I have been formally assigned to this issue and noted it above.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@avzuha is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@steam-bell-92 steam-bell-92 merged commit 4c1414b into steam-bell-92:main May 22, 2026
11 of 12 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants