@@ -160,6 +160,60 @@ const DYNAMIC_TWEAKS = [
160160 // Commit group headers in commit listings.
161161 { selector : '.commit-group-title' ,
162162 tweak : [ makeHeading , 2 ] } ,
163+ // Project boards
164+ // Label columns
165+ {
166+ selector : '.js-project-column' ,
167+ tweak : el => {
168+ el . setAttribute ( 'aria-roledescription' , 'column' ) ;
169+ let heading = el . querySelector ( 'h3' ) ;
170+ let headingId = setAriaIdIfNecessary ( heading ) ;
171+ el . setAttribute ( 'aria-labelledby' , headingId ) ;
172+ } ,
173+ } ,
174+ // Label and describe cards
175+ {
176+ selector : '.js-project-column-card' ,
177+ tweak : el => {
178+ el . setAttribute ( 'aria-roledescription' , 'card' ) ;
179+ let label = "" ;
180+ let description = "" ;
181+ let commentBody = el . querySelector ( '.js-comment-body' ) ;
182+ if ( commentBody ) {
183+ label += "Note " ;
184+ label += commentBody . innerText ;
185+ } else if ( el . matches ( '.issue-card' ) ) {
186+ let octicon = el . querySelector ( '.js-issue-octicon' ) ;
187+ if ( octicon ) {
188+ if ( octicon . matches ( '.octicon-issue-closed' ) ) {
189+ label += "Closed issue " ;
190+ } else if ( octicon . matches ( '.octicon-issue-open' ) ) {
191+ label += "Open issue " ;
192+ } else if ( octicon . matches ( '.octicon-git-pull-request.closed' ) ) {
193+ label += "Closed PR " ;
194+ } else if ( octicon . matches ( '.octicon-git-pull-request.draft' ) ) {
195+ label += "Draft PR " ;
196+ } else if ( octicon . matches ( '.octicon-git-pull-request.open' ) ) {
197+ label += "Open PR " ;
198+ } else if ( octicon . matches ( '.octicon-git-pull-request.merged' ) ) {
199+ label += "Merged PR " ;
200+ } else {
201+ label += octicon . getAttribute ( 'aria-label' ) + " " ;
202+ }
203+ }
204+ let assignee = el . querySelector ( '.AvatarStack-body .avatar-user' ) ;
205+ if ( assignee ) {
206+ label += assignee . getAttribute ( 'alt' ) + " " ;
207+ }
208+ let issueLink = el . querySelector ( '.js-project-card-issue-link' ) ;
209+ label += issueLink . innerText ;
210+ let details = issueLink . nextElementSibling ;
211+ description += details . innerText ;
212+ }
213+ el . setAttribute ( 'aria-label' , label ) ;
214+ el . setAttribute ( 'aria-description' , description ) ;
215+ } ,
216+ } ,
163217] ;
164218
165219/*** Lights, camera, action! ***/
0 commit comments