@@ -259,7 +259,7 @@ export abstract class GenericEditableConfigList<
259259
260260 /**
261261 * Returns the raw list of items from the current data, or `[]` when data
262- * has not yet loaded. Centralises the `any` cast required because `T` is
262+ * has not yet loaded. Centralizes the `any` cast required because `T` is
263263 * not constrained to include `listDataKey`.
264264 */
265265 protected getItems ( ) : U [ ] {
@@ -375,6 +375,16 @@ export abstract class GenericEditableConfigList<
375375 libraryCount > 0 &&
376376 ! ! this . state . expandedItems [ itemKey ] ;
377377
378+ const itemLabel = this . label ( item ) ;
379+ const expandVerb = isExpanded ? "Collapse" : "Expand" ;
380+ const expandAction = isExpanded ? "collapse" : "expand" ;
381+ const toggleButtonLabel = `${ expandVerb } associations for ${ itemLabel } (Alt+Click to ${ expandAction } all)` ;
382+ const ariaExpandedProp =
383+ libraryCount > 0 ? { "aria-expanded" : isExpanded } : { } ;
384+ const editHref = this . urlBase + "edit/" + item [ this . identifierKey ] ;
385+ const canEdit = this . canEdit ( item ) ;
386+ const canDelete = this . canDelete ( ) ;
387+
378388 return (
379389 < li key = { itemKey } >
380390 < div className = "item-header" >
@@ -387,24 +397,16 @@ export abstract class GenericEditableConfigList<
387397 ? this . toggleAllAssociations ( )
388398 : this . toggleAssociations ( itemKey )
389399 }
390- { ...( libraryCount > 0 ? { "aria-expanded" : isExpanded } : { } ) }
391- aria-label = { `${
392- isExpanded ? "Collapse" : "Expand"
393- } associations for ${ this . label ( item ) } (Alt+Click to ${
394- isExpanded ? "collapse" : "expand"
395- } all)`}
396- title = { `${
397- isExpanded ? "Collapse" : "Expand"
398- } associations for ${ this . label ( item ) } (Alt+Click to ${
399- isExpanded ? "collapse" : "expand"
400- } all)`}
400+ { ...ariaExpandedProp }
401+ aria-label = { toggleButtonLabel }
402+ title = { toggleButtonLabel }
401403 disabled = { libraryCount === 0 }
402404 >
403405 < DisclosureIcon expanded = { isExpanded } />
404406 </ button >
405407 ) }
406408 < h3 >
407- { this . label ( item ) }
409+ { itemLabel }
408410 { libraryCount !== null && (
409411 < span className = "library-count" >
410412 { " " }
@@ -414,11 +416,8 @@ export abstract class GenericEditableConfigList<
414416 </ h3 >
415417 </ div >
416418
417- < a
418- className = "btn small edit-item"
419- href = { this . urlBase + "edit/" + item [ this . identifierKey ] }
420- >
421- { this . canEdit ( item ) ? (
419+ < a className = "btn small edit-item" href = { editHref } >
420+ { canEdit ? (
422421 < span >
423422 Edit < PencilIcon />
424423 </ span >
@@ -429,7 +428,7 @@ export abstract class GenericEditableConfigList<
429428 ) }
430429 </ a >
431430
432- { this . canDelete ( ) && (
431+ { canDelete && (
433432 < Button
434433 className = "danger delete-item small"
435434 callback = { ( ) => this . delete ( item ) }
0 commit comments