Skip to content

feat(keyboard): add VirtualKeyboard with visual state indicators - #1310

Merged
kike-alt merged 1 commit into
kike-alt:mainfrom
nanaf6203-bit:feat/issue-1234-keyboard-visual-states
Aug 26, 2026
Merged

feat(keyboard): add VirtualKeyboard with visual state indicators#1310
kike-alt merged 1 commit into
kike-alt:mainfrom
nanaf6203-bit:feat/issue-1234-keyboard-visual-states

Conversation

@nanaf6203-bit

@nanaf6203-bit nanaf6203-bit commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Closes #1234

Closes #1233

Closes #1235

Closes #1236

Creates the VirtualKeyboard component with distinct visual states for correct (green), misplaced (yellow), and absent (dark gray) letter keys. Each KeyButton is wrapped in React.memo with a custom comparison to prevent unnecessary re-renders when other keys change state.

Why

The virtual keyboard is the primary input mechanism for Wordle gameplay. Without visual state indicators, players cannot track which letters have been guessed and their correctness. The component uses a keyStatuses prop (Record<string, KeyStatus>) that the parent game component can derive from guess evaluation results.

What was built

frontend/src/components/VirtualKeyboard.tsx:

Export What it contains
KeyStatus type Union: `'correct'
VirtualKeyboardProps onKeyPress, onEnter, onBackspace, keyStatuses, disabled
KeyButton (internal) React.memo-wrapped key with status-dependent Tailwind classes
VirtualKeyboard Three QWERTY rows with ENTER/BACKSPACE action keys

frontend/src/components/VirtualKeyboard.spec.tsx:

Test What it covers
Renders all keys All 26 letters + ENTER + BACKSPACE present
onKeyPress Clicking letter key fires callback with uppercase letter
onEnter ENTER button fires submit callback
onBackspace BACKSPACE button fires delete callback
correct status Green bg-green-600 class applied
present status Yellow bg-yellow-500 class applied
absent status Dark gray bg-gray-600 class applied
disabled All buttons disabled, no handlers fire

No existing files modified — only additions, so regression risk is low.

Acceptance criteria coverage

  • Apply green background color for keys matching correct letter placement (VirtualKeyboard.spec.tsx — correct status suite)
  • Apply yellow background color for keys matching misplaced letter placement (VirtualKeyboard.spec.tsx — present status suite)
  • Apply dark gray background color for absent letters (VirtualKeyboard.spec.tsx — absent status suite)
  • Add unit tests in VirtualKeyboard.spec.tsx verifying class assignments (VirtualKeyboard.spec.tsx — 10 tests total)

Test plan

  • npm test — not run per instruction
  • npm run build — not run per instruction

Env vars / Notes

No new environment variables. The component is a pure presentational component that accepts callbacks and a status map — it has no side effects or API dependencies.

- Create VirtualKeyboard component with per-key status colors:
  green for correct, yellow for present, dark gray for absent
- Wrap KeyButton in React.memo for performance
- Support ENTER, BACKSPACE, and letter key actions
- Add comprehensive unit tests verifying class assignments and handlers
- Include disabled state and aria-labels for accessibility

Closes kike-alt#1234
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@nanaf6203-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@kike-alt
kike-alt merged commit 94607ac into kike-alt:main Aug 26, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants