Skip to content

Commit 1c060bb

Browse files
committed
Trello: Make the checkbox for due date completion accessible.
1 parent b718ef2 commit 1c060bb

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

TrelloA11yFixes.user.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ function tweakCheckItem(checkItem, isNew) {
4747
checkbox.setAttribute("aria-checked", complete ? "true" : "false");
4848
}
4949

50+
function tweakDueDateComplete(completeBadge, isNew) {
51+
var checkbox = completeBadge.querySelector(".card-detail-badge-due-date-complete-box");
52+
if (isNew) {
53+
checkbox.setAttribute("role", "checkbox");
54+
checkbox.setAttribute("tabindex", "-1");
55+
checkbox.setAttribute("aria-label", "Complete");
56+
}
57+
var complete = completeBadge.classList.contains("is-due-complete");
58+
checkbox.setAttribute("aria-checked", complete ? "true" : "false");
59+
}
60+
5061
function onNodeAdded(target) {
5162
if (target.classList.contains("list-card")) {
5263
// A card just got added.
@@ -93,6 +104,9 @@ function onNodeAdded(target) {
93104
for (var checkItem of target.querySelectorAll(".checklist-item")) {
94105
tweakCheckItem(checkItem, true);
95106
}
107+
for (var dueComplete of target.querySelectorAll(".card-detail-due-date-badge")) {
108+
tweakDueDateComplete(dueComplete, true);
109+
}
96110
}
97111

98112
function onClassModified(target) {
@@ -104,6 +118,8 @@ function onClassModified(target) {
104118
target.focus();
105119
} else if (classes.contains("checklist-item")) {
106120
tweakCheckItem(target, false);
121+
} else if (classes.contains("card-detail-due-date-badge")) {
122+
tweakDueDateComplete(target, false);
107123
}
108124
}
109125

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ It does the following:
9999
- Prevents loss of position for screen reader users when pressing the control key.
100100
- Adds a shift+m keyboard shortcut to quickly move a card.
101101
- Makes checklists accessible.
102+
- Makes the checkbox for due date completion accessible.

0 commit comments

Comments
 (0)