Skip to content

fix(daisyui): translate the SelectWidget empty-selection fallback - #5512

Merged
heath-freenome merged 7 commits into
rjsf-team:v7from
charan-rathore:fix/daisyui-select-placeholder-5498
Oct 13, 2026
Merged

heath-freenome merged 7 commits into
rjsf-team:v7from
charan-rathore:fix/daisyui-select-placeholder-5498

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Fixes #5498

What was wrong

With no value selected, no ui:placeholder and no label, the daisyui SelectWidget trigger fell back to a hardcoded 'Select...', so a translateString mapping TranslatableString.SelectPlaceholder localized the shadcn widget but not this one.

The fix

The fallback now reads registry.translateString(TranslatableString.SelectPlaceholder), the way the shadcn widget does. The default English text becomes 'Select ...' (the enum's value), matching shadcn.

Tests

  • New unit test in SelectWidget.test.tsx: a custom translateString maps the placeholder, and the trigger renders the translated fallback.
  • Form and Array snapshots updated for the default text change (Select... to Select ...); the diff is text-only.
  • SelectWidget.test.tsx passes 21/21. Note: the additionalProperties cases in Object.test.tsx fail their snapshots on current v7 in my environment both with and without this change, so I left that snapshot file untouched.

Checklist

  • I have updated the CHANGELOG.md for the package(s) I modified
  • I have added tests that prove my fix is effective

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Size limit report

Sizes are minified + brotli, measured by size-limit at 0b3f19b.

A package listed twice is measured both as installed and, on the second row, as its own code with its dependencies excluded. Peer dependencies are always excluded.

Check Base PR Δ
@rjsf/antd 7.40 kB 7.40 kB =
@rjsf/antd (without dependencies) 6.98 kB 6.98 kB =
@rjsf/chakra-ui 18.84 kB 18.84 kB =
@rjsf/chakra-ui (without dependencies) 10.73 kB 10.73 kB =
@rjsf/core 32.54 kB 32.54 kB =
@rjsf/core/markdown 25.53 kB 25.53 kB =
@rjsf/core/testing 62.12 kB 62.12 kB =
@rjsf/core: Form 32.34 kB 32.34 kB =
@rjsf/daisyui 54.14 kB 54.13 kB =
@rjsf/daisyui (without dependencies) 11.23 kB 11.25 kB +0.02 kB
@rjsf/fluentui-rc 5.76 kB 5.76 kB =
@rjsf/mantine 14.41 kB 14.41 kB =
@rjsf/mantine (without dependencies) 10.05 kB 10.05 kB =
@rjsf/mui 6.59 kB 6.59 kB =
@rjsf/react-bootstrap 7.72 kB 7.72 kB =
@rjsf/react-bootstrap (without dependencies) 5.30 kB 5.30 kB =
@rjsf/shadcn 43.55 kB 43.55 kB =
@rjsf/shadcn (without dependencies) 9.27 kB 9.27 kB =
@rjsf/utils 31.25 kB 31.25 kB =
@rjsf/utils (without dependencies) 25.62 kB 25.62 kB =
@rjsf/utils: getUiOptions 0.65 kB 0.65 kB =
@rjsf/validator-ajv8 38.14 kB 38.14 kB =
@rjsf/validator-ajv8 (without dependencies) 2.66 kB 2.66 kB =
@rjsf/validator-ata 86.24 kB 86.24 kB =
@rjsf/validator-ata (without dependencies) 2.41 kB 2.41 kB =
@rjsf/validator-cfworker 7.22 kB 7.22 kB =
@rjsf/validator-cfworker (without dependencies) 2.30 kB 2.30 kB =

Comment thread CHANGELOG.md Outdated

## @rjsf/daisyui

- Fixed the `SelectWidget` trigger falling back to a hardcoded `'Select...'` with no value selected, no `ui:placeholder` and no label, fixing [#5498](https://github.com/rjsf-team/react-jsonschema-form/issues/5498). The fallback now reads `translateString(TranslatableString.SelectPlaceholder)`, the way the shadcn widget does, so a custom `translateString` localizes it (the default English text becomes `'Select ...'`)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This entry is in the wrong changelog. The PR targets v7, whose entries go in CHANGELOG-v7.md under # 7.0.0 → ## @rjsf/daisyui; this line lands in CHANGELOG.md under # 6.9.0, which is already tagged and released (v6.9.0), so the release notes would attribute the fix to a version that doesn't contain it. TranslatableString.SelectPlaceholder itself only exists on v7 (it is listed under @rjsf/utils in CHANGELOG-v7.md), so the entry can't be true of any 6.x release.

Could you move it to CHANGELOG-v7.md, as the last bullet of the ## @rjsf/daisyui section rather than the first?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, moved in c8b12db: the entry is out of CHANGELOG.md (6.9.0 is tagged) and now the last bullet of the ## @rjsf/daisyui section in CHANGELOG-v7.md.

{hasValue ? selectedLabels.join(', ') : placeholder || label || 'Select...'}
{hasValue
? selectedLabels.join(', ')
: placeholder || label || registry.translateString(TranslatableString.SelectPlaceholder)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two consumer-visible effects of this line that the v7 upgrade guide doesn't cover for daisyui yet:

  • The default English text changes from Select... to Select .... Where no label names the button (a root field, a oneOf/anyOf option selector) that text is also its accessible name, so a consumer's getByRole('button', { name: 'Select...' }) or snapshot of a daisyui form breaks.
  • A translateString built as a lookup table without a fallback to englishStringTranslator returns undefined for the new key. The trigger then renders empty, and in the unlabeled case the button is left with no accessible name at all (the ▼ is aria-hidden), where it used to say Select....

The guide's section "@rjsf/shadcn's SelectWidget names its combobox and fills empty placeholders" already tells shadcn users that a translateString table gains the TranslatableString.SelectPlaceholder key and that snapshots change; daisyui users need the same note (either there or in the daisyui markup section).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in c8b12db: added a section to the v7 upgrade guide right after the shadcn one. It covers both effects - the Select... -> Select ... text change (and the snapshot/getByRole breakage where the text was the trigger's accessible name) and the SelectPlaceholder key that a lookup-table translateString needs, with the empty-trigger failure spelled out.

WidgetProps,
} from '@rjsf/utils';
import {
TranslatableString,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The JSDoc on this key in packages/utils/src/enums.ts still reads "used by the shadcn SelectWidget":

/** Placeholder for a select input, and its accessible name when the field has no title, used by the shadcn SelectWidget */
SelectPlaceholder: 'Select ...',

With this change daisyui's SelectWidget reads it too, so the comment should name both (the neighbouring keys list their users the same way, e.g. "used by the daisyUI date pickers").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in c8b12db - the JSDoc now names the shadcn and daisyui SelectWidgets.

@jimmycallin jimmycallin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the quick update, this looks good. Two small things before merging:

  • Changelog: please move the new bullet to the end of the ## @rjsf/daisyui list in CHANGELOG-v7.md. It is currently inserted before the TextareaWidget bullet; new entries go after the existing ones.
  • Upgrade guide: please remove the section added to v7.x upgrade guide.md. On reflection this isn't a breaking change, so it doesn't belong there, and the changelog entry already covers the new default text. Sorry for the back and forth on that one.

@charan-rathore

Copy link
Copy Markdown
Contributor Author

Done in a7c3b97: the changelog bullet is now the last one in the ## @rjsf/daisyui list, after the ui:enumDisabled entry, and the section in v7.x upgrade guide.md is removed entirely. No trouble on the back and forth - it is not a breaking change, and the changelog entry covers the new default text.

@jimmycallin

Copy link
Copy Markdown
Collaborator

Please resolve conflicts

@charan-rathore

Copy link
Copy Markdown
Contributor Author

Resolved in 9166021 - the daisyui list gained the #5474 bullet upstream, so the rebase keeps both, with this one still at the end.

Charan Rathore and others added 7 commits October 14, 2026 01:28
The trigger fell back to a hardcoded 'Select...' with no value selected, no
ui:placeholder and no label, so a translateString mapping
TranslatableString.SelectPlaceholder localized the shadcn widget but not this
one. Read the fallback through registry.translateString the way shadcn does.

Fixes rjsf-team#5498.

Signed-off-by: Charan Rathore <[email protected]>
…ing the readonly registry

Signed-off-by: Charan Rathore <[email protected]>
The entry sat in CHANGELOG.md under 6.9.0, which is already tagged; it
belongs to v7, whose TranslatableString.SelectPlaceholder key it
describes. The upgrade guide notes the daisyui trigger text change and
the new translateString key, and the key's JSDoc names both SelectWidget
users.

Signed-off-by: Charan Rathore <[email protected]>
…op the upgrade guide section

The fix is not a breaking change, so the v7 upgrade guide does not
carry it; the changelog entry covers the new default text.

Signed-off-by: Charan Rathore <[email protected]>
@heath-freenome
heath-freenome merged commit a851117 into rjsf-team:v7 Oct 13, 2026
7 checks passed
@heath-freenome heath-freenome mentioned this pull request Nov 13, 2026
Merged
8 tasks
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.

3 participants