Skip to content

fix(ui): resolve card aria-label showing [object Object] for localized labels - #17096

Closed
ikhana wants to merge 1 commit into
payloadcms:mainfrom
ikhana:fix/card-aria-label-localization
Closed

ikhana wants to merge 1 commit into
payloadcms:mainfrom
ikhana:fix/card-aria-label-localization

Conversation

@ikhana

@ikhana ikhana commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What?

The createNewLabel aria-label on collection card buttons displays [object Object] instead of the localized collection name when collection labels are defined as multilingual objects (e.g., { en: 'Pages', de: 'Seiten' }).

Why?

Line 106 in CollectionCards/index.tsx passes the raw label object directly to the t() translation function. Since label is an object (not a string), JavaScript coerces it to [object Object]. The other translation calls in the same file (showAllLabel on line 50, editLabel on line 68-69) already resolve the label correctly — this one was missed.

How?

Changed label to label: title on line 106, where title is already resolved via getTranslation(label, i18n) on line 48. One-line change, consistent with the existing pattern in the same file.

Fixes #17069

@GermanJablo

Copy link
Copy Markdown
Contributor

Thanks for the fix! Closing this as a duplicate of #17664, which covers both CollectionCards implementations and adds a regression test. Note that main already includes this fix via #18358; the remaining work is the 3.x backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card button aria-label and title not correctly localized

2 participants