1+ import { useId } from 'react' ;
12import PropTypes from 'prop-types' ;
23import Button from '@mui/material/Button' ;
34import Typography from '@mui/material/Typography' ;
@@ -9,9 +10,11 @@ import CollapsibleSection from '../containers/CollapsibleSection';
910 * CollectionInfo
1011 */
1112export function CollectionInfo ( {
12- collectionLabel = null , collectionPath = [ ] , id , showCollectionDialog, windowId = null ,
13+ collectionLabel = null , collectionPath = [ ] , showCollectionDialog, windowId = null ,
1314} ) {
1415 const { t } = useTranslation ( ) ;
16+ const id = useId ( ) ;
17+ const titleId = useId ( ) ;
1518
1619 /**
1720 * Show the containing collection.
@@ -26,13 +29,13 @@ export function CollectionInfo({
2629
2730 return (
2831 < CollapsibleSection
29- id = { ` ${ id } -collection` }
32+ id = { id }
3033 label = { t ( 'collection' ) }
3134 >
3235 { collectionLabel && (
3336 < Typography
34- aria-labelledby = { `${ id } -resource ${ id } -resource-heading ` }
35- id = { ` ${ id } -resource-heading` }
37+ aria-labelledby = { `${ id } ${ titleId } ` }
38+ id = { titleId }
3639 variant = "h4"
3740 >
3841 { collectionLabel }
@@ -53,7 +56,6 @@ export function CollectionInfo({
5356CollectionInfo . propTypes = {
5457 collectionLabel : PropTypes . string ,
5558 collectionPath : PropTypes . arrayOf ( PropTypes . string ) ,
56- id : PropTypes . string . isRequired ,
5759 showCollectionDialog : PropTypes . func . isRequired ,
5860 windowId : PropTypes . string ,
5961} ;
0 commit comments