@@ -53,9 +53,10 @@ const ShareURL = ({ value }) => {
53
53
< button
54
54
className = "collection-share__button"
55
55
onClick = { ( ) => setShowURL ( ! showURL ) }
56
+ aria-label = "Show collection share URL"
56
57
>
57
58
< span > Share</ span >
58
- < DropdownArrowIcon className = "collection-share__arrow" />
59
+ < DropdownArrowIcon className = "collection-share__arrow" focusable = "false" aria-hidden = "true" />
59
60
</ button >
60
61
{ showURL &&
61
62
< div className = "collection__share-dropdown" >
@@ -97,8 +98,9 @@ class CollectionItemRowBase extends React.Component {
97
98
< button
98
99
className = "collection-row__remove-button"
99
100
onClick = { this . handleSketchRemove }
101
+ aria-label = "Remove sketch from collection"
100
102
>
101
- < RemoveIcon title = "Remove " />
103
+ < RemoveIcon focusable = "false" aria-hidden = "true " />
102
104
</ button >
103
105
</ td >
104
106
</ tr > ) ;
@@ -295,21 +297,43 @@ class Collection extends React.Component {
295
297
return null ;
296
298
}
297
299
300
+ _getButtonLabel = ( fieldName , displayName ) => {
301
+ const { field, direction } = this . props . sorting ;
302
+ let buttonLabel ;
303
+ if ( field !== fieldName ) {
304
+ if ( field === 'name' ) {
305
+ buttonLabel = `Sort by ${ displayName } ascending.` ;
306
+ } else {
307
+ buttonLabel = `Sort by ${ displayName } descending.` ;
308
+ }
309
+ } else if ( direction === SortingActions . DIRECTION . ASC ) {
310
+ buttonLabel = `Sort by ${ displayName } descending.` ;
311
+ } else {
312
+ buttonLabel = `Sort by ${ displayName } ascending.` ;
313
+ }
314
+ return buttonLabel ;
315
+ }
316
+
298
317
_renderFieldHeader ( fieldName , displayName ) {
299
318
const { field, direction } = this . props . sorting ;
300
319
const headerClass = classNames ( {
301
320
'sketches-table__header' : true ,
302
321
'sketches-table__header--selected' : field === fieldName
303
322
} ) ;
323
+ const buttonLabel = this . _getButtonLabel ( fieldName , displayName ) ;
304
324
return (
305
325
< th scope = "col" >
306
- < button className = "sketch-list__sort-button" onClick = { ( ) => this . props . toggleDirectionForField ( fieldName ) } >
326
+ < button
327
+ className = "sketch-list__sort-button"
328
+ onClick = { ( ) => this . props . toggleDirectionForField ( fieldName ) }
329
+ aria-label = { buttonLabel }
330
+ >
307
331
< span className = { headerClass } > { displayName } </ span >
308
332
{ field === fieldName && direction === SortingActions . DIRECTION . ASC &&
309
- < ArrowUpIcon />
333
+ < ArrowUpIcon role = "img" aria-label = "Ascending" focusable = "false" />
310
334
}
311
335
{ field === fieldName && direction === SortingActions . DIRECTION . DESC &&
312
- < ArrowDownIcon />
336
+ < ArrowDownIcon role = "img" aria-label = "Descending" focusable = "false" />
313
337
}
314
338
</ button >
315
339
</ th >
0 commit comments