Todo List
UI Coding
Easy
25 min
state
forms
lists
accessibility
Build a todo list. The starter shows the layout with three sample tasks, but nothing works.
Requirements
- Add: type into the "New task" input and press <kbd>Enter</kbd> or click Add. Trim whitespace and ignore empty input. After adding, clear the input and keep focus in it so the user can type the next task.
- Complete: each task has a checkbox labelled with the task text. Completed tasks are shown struck through.
- Delete: each task has a delete button whose accessible name includes the task ("Delete Buy milk"). After deleting, move focus somewhere sensible, not to
<body>. - Filters: All / Active / Completed. The current filter is exposed to assistive tech with
aria-pressed. - Show a count: "2 tasks left" (with correct singular/plural: "1 task left").
- When the list is empty for the current filter, show a friendly message instead.
Follow-up
- Why is the array index a bad
keyhere? - Add inline editing (double-click or an Edit button). What focus rules apply?
- How would you persist the list and sync it across browser tabs?
Spotted a mistake or a rights concern? Report an issue