@@ -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+
5061function 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
98112function 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
0 commit comments