Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect aria-describedby attributes for theme patterns #52263

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/edit-site/src/components/page-patterns/grid-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
aria-label={ item.title }
aria-describedby={
ariaDescriptions.length
? ariaDescriptions.join( ' ' )
? ariaDescriptions
.map(
( _, index ) =>
`${ descriptionId }-${ index }`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: ${ descriptionId }-${ index } is used one more time, a few lines below, and could be set to a variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two uses of ${ descriptionId }-${ index } are in separate loops so I'm not sure they can be extracted to a shared variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Aside: I'm not even sure why there is the need to push the notifications/IDs to an array. Is there any case where a pattern can have more than one description?

)
.join( ' ' )
: undefined
}
>
Expand Down
Loading