fix: keyboard-visible delete, valid list semantics, undo support

The delete button was opacity:0 and only revealed on hover, so tabbing to
it showed nothing at all. The focus outline was being drawn on an
invisible element. It shows on :focus-within now too.

The row was role="button" with tabindex=0 while containing two real
buttons, which isn't valid. Rows are <li> in a <ul> now, so the list gets
announced with its count and position, and the checkbox carries the task
text plus aria-pressed.

Backspace no longer deletes. It's the key people hit meaning "go back",
and there was no way to get the task back afterwards. Delete still works,
and Cmd/Ctrl+Z reverses it.

Enter and Escape move from window to the input. On window, pressing Enter
with a task focused toggled that task and also added whatever was sitting
in the input.
This commit is contained in:
Aculix Technologies
2026-08-16 00:09:58 +05:30
parent 756b4254b4
commit cf64159322
2 changed files with 67 additions and 21 deletions
+14 -3
View File
@@ -242,11 +242,18 @@ body {
}
.task-list {
min-height: 400px;
position: relative;
}
/* A real list, so screen readers announce item counts and position. */
.task-items {
display: flex;
flex-direction: column;
gap: 12px;
min-height: 400px;
position: relative;
list-style: none;
margin: 0;
padding: 0;
}
.task-item {
@@ -362,7 +369,11 @@ body {
flex-shrink: 0;
}
.task-item:hover .delete-btn {
/* focus-within matters as much as hover here: the button is opacity 0 by
default, so a keyboard user tabbing to it previously saw nothing at all —
the focus outline was drawn on an invisible element. */
.task-item:hover .delete-btn,
.task-item:focus-within .delete-btn {
opacity: 1;
}