Repository navigation
Closed
Labels
Description
Describe the Bug
I am seeing [object Object] values for localized collection names in card buttons:
<a type="button" aria-label="[object Object] neu erstellen" class="btn btn--icon btn--icon-style-with-border btn--icon-only btn--size-medium btn--icon-position-right btn--withoutPopup btn--style-icon-label btn--round btn--withoutPopup" title="[object Object] neu erstellen" href="/admin/collections/pages/create"><span class="btn__content"><span class="btn__icon"><svg class="icon icon--plus" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path class="stroke" d="M5.33333 9.99998H14.6667M9.99999 5.33331V14.6666" stroke-linecap="square"></path></svg></span></span></a>
Payload uses:
"aria-label": t('general:createNewLabel', {
label
})| label, |
For localized collection labels, label is an object like { en: 'Pages', de: 'Seiten' }. German translation is {{label}} neu erstellen, so interpolating the object becomes [object Object] neu erstellen. Payload’s Button also copies aria-label into title, so both attributes show it.
Correct fix would be:
title = getTranslation(label, i18n)
...
"aria-label": t('general:createNewLabel', {
label: title
})Link to the code that reproduces this issue
Reproduction Steps
Check the aria-label text in the admin panel for localized collection labels.
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 26.3.0
npm: 11.16.0
Yarn: N/A
pnpm: N/A
Relevant Packages:
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.5.0: Mon Apr 27 20:39:42 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6031
Available memory (MB): 65536
Available CPU cores: 16
Activity
[-]Card button aria-label and not correctly localized[/-][+]Card button aria-label and title not correctly localized[/+]stefantschierschke commentedon Jul 2, 2026
Confirmed on both 3.85.1 AND 3.85.2 - bug is still present.
The line moved slightly since your linked commit; in v3.85.2 the offending
call is at
https://github.com/payloadcms/payload/blob/v3.85.2/packages/ui/src/widgets/CollectionCards/index.tsx#L109-L111
(dist-shipped as line 111 of the compiled index.js).
Rendered attributes (DE portal,
labels: { plural: { de: 'Seiten', en: 'Pages' } }):Both attributes carry the same broken string . the
titlepropagates becausePayload's Button sets
title = aria-labelunconditionally (seepackages/ui/src/elements/Button/index.tsx, compiled dist/.../index.js linearound 100).
Your suggested fix (
label: title, reusing the already-computed value fromgetTranslation(label, i18n)two lines above) is the cleanest. Happy toopen a PR against
mainif that unblocks things.1yakub commentedon Aug 5, 2026
I can take this one if it's still open. The label just needs to go through getTranslation before it hits createNewLabel, same as the showAllLabel call right above it.
stefantschierschke commentedon Aug 25, 2026
Still reproducible on 3.88.0 — unchanged since my report on 3.85.2 (three
minor releases ago).
packages/ui/src/widgets/CollectionCards/index.tsx#L109-L110 (v3.88.0):
The raw label object is still interpolated, so screen readers announce
"[object Object] neu erstellen". The same file already does it correctly
two branches above (L52:
t('general:showAllLabel', { label: title })with
title = getTranslation(label, i18n)) and again at L124 — so this isa one-line change to match the surrounding code.
There are now three open PRs for it (#17070, #17096, #17664), none merged,
and the issue is still labelled needs-triage after two months. Could a
maintainer triage it and pick whichever PR fits? Happy to help review or
rebase if that unblocks things.
emmpauldev commentedon Aug 25, 2026
Same pattern exists in
DocumentDrawerToggler:https://github.com/payloadcms/payload/blob/main/packages/ui/src/elements/DocumentDrawer/index.tsx#L48-L50
labels.singularis interpolated raw, so a localized label object (e.g.{ en: 'Form', fr: 'Formulaire' }) renders the accessible name as "Add new [object Object]" on the "Add new" button of every relationship field whose related collection has localized labels. Both branches of the ternary are affected (addNewLabelandeditLabel).Note the visible text of the same button is fine:
AddNewRelationruns the label throughgetTranslationbefore interpolating. Only thearia-labelbreaks, and it takes precedence over the visible text for the accessible name, so screen readers get the broken one (WCAG 4.1.2).Reproduced on 3.86.0 and 3.88.0; the code is unchanged on current
main. ThegetTranslationwrap proposed above would fix this occurrence too.fix(ui): translate the collection label in the create new card button…
fix(ui): translate document drawer labels (3.x) (#19154)
fix(ui): translate document drawer labels (#17959)
GermanJablo commentedon Oct 29, 2026
Fixed in both release lines. The dashboard collection card button: #18358 (main) and #19116 (3.x). The document drawer toggler reported in the comments: #17959 (main) and #19154 (3.x). The 3.x fixes ship in the next 3.x release, and the main fix in the next v4 beta. Thanks for the report! The remaining sort buttons case is tracked in #19198.
github-actions commentedon Nov 4, 2026
🚀 This is included in version v3.93.0