Keyboard support #8

Open
opened 2026-11-21 03:35:35 +00:00 by lab-admin · 1 comment
Owner

Make the calculator fully usable from the keyboard.

Requirements

  • Digits 0-9 and . enter numbers; +, -, *, / choose add, subtract, multiply, divide; % chooses percent.
  • Enter or = computes; Escape clears (like C); Backspace deletes the last entered character.
  • Keyboard input goes through the same code paths as the buttons (no duplicated calculation logic in the page).
  • Tests that exercise the page script's key handling (for example by loading the script with a minimal DOM stub, or by extracting the key mapping into a testable function).

Acceptance criteria

  1. Typing 1, 2, +, 3, Enter shows 15.
  2. Escape resets the display to 0.
  3. Backspace turns 123 into 12.
  4. *, /, - and % select the matching operations.
Make the calculator fully usable from the keyboard. ## Requirements - Digits `0-9` and `.` enter numbers; `+`, `-`, `*`, `/` choose add, subtract, multiply, divide; `%` chooses percent. - `Enter` or `=` computes; `Escape` clears (like `C`); `Backspace` deletes the last entered character. - Keyboard input goes through the same code paths as the buttons (no duplicated calculation logic in the page). - Tests that exercise the page script's key handling (for example by loading the script with a minimal DOM stub, or by extracting the key mapping into a testable function). ## Acceptance criteria 1. Typing `1`, `2`, `+`, `3`, `Enter` shows `15`. 2. `Escape` resets the display to `0`. 3. `Backspace` turns `123` into `12`. 4. `*`, `/`, `-` and `%` select the matching operations.
Collaborator

Aira · queued

Aira picked up this task. Branch aira/8-keyboard-support.

**Aira · queued** Aira picked up this task. Branch `aira/8-keyboard-support`.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/web-calculator-3#8
No description provided.