Skip to content

Commit 31d069d

Browse files
committed
Add label for task and deadline to improve accessibility in ToDo list
1 parent ecbf2f4 commit 31d069d

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎Sprint-3/todo-list/index.html‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,24 @@
1717
<h1>My ToDo List</h1>
1818

1919
<div class="todo-input">
20+
<label for="new-task-input" class="visually-hidden">Task</label>
2021
<input
2122
type="text"
2223
id="new-task-input"
2324
placeholder="Enter a new task..."
2425
/>
26+
<label for="new-task-deadline" class="visually-hidden"
27+
>Deadline (optional)</label
28+
>
2529
<input type="date" id="new-task-deadline" />
2630
<button id="add-task-btn">Add</button>
2731
</div>
2832

2933
<ul id="todo-list" class="todo-list"></ul>
3034
<button id="delete-completed-btn">Delete completed tasks</button>
3135

32-
<!--
33-
This is a template for the To-do list item.
34-
It can simplify the creation of list item node in JS script.
35-
-->
3636
<template id="todo-item-template">
3737
<li class="todo-item">
38-
<!-- include class "completed" if the task completed state is true -->
3938
<span class="description">Task description</span>
4039
<span class="deadline"></span>
4140
<div class="actions">

‎Sprint-3/todo-list/style.css‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ h1 {
3030
margin-bottom: 20px;
3131
}
3232

33+
.visually-hidden {
34+
position: absolute;
35+
width: 1px;
36+
height: 1px;
37+
margin: -1px;
38+
padding: 0;
39+
overflow: hidden;
40+
white-space: nowrap;
41+
border: 0;
42+
}
43+
3344
.todo-input input {
3445
flex: 1;
3546
padding: 10px;
@@ -41,7 +52,7 @@ h1 {
4152
.todo-input button {
4253
padding: 10px 20px;
4354
font-size: 16px;
44-
background-color: #4CAF50;
55+
background-color: #4caf50;
4556
color: white;
4657
border: none;
4758
border-radius: 6px;

0 commit comments

Comments
 (0)