Accessibility: Fix broken aria label & description in CollectionListItem (#39165)
This commit is contained in:
parent
e1aa4e3a8c
commit
cc03e381ef
@ -27,14 +27,14 @@ export const CollectionListItem: React.FC<CollectionListItemProps> = ({
|
|||||||
...otherProps
|
...otherProps
|
||||||
}) => {
|
}) => {
|
||||||
const uniqueId = useId();
|
const uniqueId = useId();
|
||||||
const linkId = `${uniqueId}-link`;
|
const titleId = `${uniqueId}-title`;
|
||||||
const infoId = `${uniqueId}-info`;
|
const subtitleId = `${uniqueId}-info`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Article
|
<Article
|
||||||
focusable
|
focusable
|
||||||
aria-labelledby={linkId}
|
aria-labelledby={titleId}
|
||||||
aria-describedby={infoId}
|
aria-describedby={subtitleId}
|
||||||
aria-posinset={positionInList}
|
aria-posinset={positionInList}
|
||||||
aria-setsize={listSize}
|
aria-setsize={listSize}
|
||||||
>
|
>
|
||||||
@ -52,6 +52,8 @@ export const CollectionListItem: React.FC<CollectionListItemProps> = ({
|
|||||||
className={classes.menuButton}
|
className={classes.menuButton}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
titleId={titleId}
|
||||||
|
subtitleId={subtitleId}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
/>
|
/>
|
||||||
</Article>
|
</Article>
|
||||||
|
|||||||
@ -48,6 +48,8 @@ export interface CollectionLockupProps {
|
|||||||
sideContent?: React.ReactNode;
|
sideContent?: React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
headingLevel?: 'h2' | 'h3' | 'h4';
|
headingLevel?: 'h2' | 'h3' | 'h4';
|
||||||
|
titleId?: string;
|
||||||
|
subtitleId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CollectionLockup: React.FC<CollectionLockupProps> = ({
|
export const CollectionLockup: React.FC<CollectionLockupProps> = ({
|
||||||
@ -56,6 +58,8 @@ export const CollectionLockup: React.FC<CollectionLockupProps> = ({
|
|||||||
withTimestamp,
|
withTimestamp,
|
||||||
sideContent,
|
sideContent,
|
||||||
headingLevel = 'h3',
|
headingLevel = 'h3',
|
||||||
|
titleId,
|
||||||
|
subtitleId,
|
||||||
className,
|
className,
|
||||||
}) => {
|
}) => {
|
||||||
const { id, name } = collection;
|
const { id, name } = collection;
|
||||||
@ -74,6 +78,7 @@ export const CollectionLockup: React.FC<CollectionLockupProps> = ({
|
|||||||
<ListItemLink
|
<ListItemLink
|
||||||
as={headingLevel}
|
as={headingLevel}
|
||||||
to={getCollectionPath(id)}
|
to={getCollectionPath(id)}
|
||||||
|
id={titleId}
|
||||||
subtitle={
|
subtitle={
|
||||||
<CollectionInfo
|
<CollectionInfo
|
||||||
collection={collection}
|
collection={collection}
|
||||||
@ -81,6 +86,7 @@ export const CollectionLockup: React.FC<CollectionLockupProps> = ({
|
|||||||
withTimestamp={withTimestamp}
|
withTimestamp={withTimestamp}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
subtitleId={subtitleId}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</ListItemLink>
|
</ListItemLink>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user