Describe the bug
Moving media to a folder fails with a validation error when using localization with fallback: false and a locale has no alt text. The plugin's custom validate function on the alt field treats all falsy values as invalid on updates (!value || value.trim().length === 0), which blocks folder moves for locales that were never filled in.
Payload fixed locale-aware folder operations in v3.56.0 (payloadcms/payload#13818), but the plugin's custom validate still runs across all locales during the update, causing the operation to fail.
To Reproduce
- Enable localization with
fallback: false and configure the alt-text plugin on a media collection with folders: true
- Upload a media item and add alt text in the primary locale only (e.g. English), leaving other locales (e.g. Spanish) empty
- Try to move the media item into a folder via the admin UI
- See validation error:
"An alternate text is required." for the unfilled locale
Expected behavior
Moving media to a folder should succeed regardless of alt text presence in non-active locales. Folder moves are metadata operations and should not trigger content validation.
Package(s) version:
@jhb.software/payload-alt-text-plugin: 0.4.4
payload: 3.82.1
Additional context
The issue is in dist/fields/altTextField.js. The validate function rejects null/undefined values (unfilled locales) the same as empty strings (explicitly cleared). A possible fix is to only enforce validation when value is a non-null empty string:
if (value != null && typeof value === 'string' && value.trim().length === 0) {
Workaround: patch the plugin via pnpm patch to set required: false and guard the validate against nullish values.
Describe the bug
Moving media to a folder fails with a validation error when using localization with
fallback: falseand a locale has no alt text. The plugin's customvalidatefunction on thealtfield treats all falsy values as invalid on updates (!value || value.trim().length === 0), which blocks folder moves for locales that were never filled in.Payload fixed locale-aware folder operations in v3.56.0 (payloadcms/payload#13818), but the plugin's custom validate still runs across all locales during the update, causing the operation to fail.
To Reproduce
fallback: falseand configure the alt-text plugin on a media collection withfolders: true"An alternate text is required."for the unfilled localeExpected behavior
Moving media to a folder should succeed regardless of alt text presence in non-active locales. Folder moves are metadata operations and should not trigger content validation.
Package(s) version:
@jhb.software/payload-alt-text-plugin: 0.4.4payload: 3.82.1Additional context
The issue is in
dist/fields/altTextField.js. The validate function rejectsnull/undefinedvalues (unfilled locales) the same as empty strings (explicitly cleared). A possible fix is to only enforce validation whenvalueis a non-null empty string:Workaround: patch the plugin via
pnpm patchto setrequired: falseand guard the validate against nullish values.