Skip to content

Rich text upload > collection > field marked as required but not actually required #1085

@ciokan

Description

@ciokan

Bug Report

Consider the following block:

import type {Block} from 'payload/types';

const RichTextBlock: Block = {
	slug        : 'RichText', // required
	imageURL    : 'https://google.com/path/to/image.jpg',
	imageAltText: 'A nice thumbnail image to show what this block looks like',
	fields      : [ // required
		{
			name        : 'content', // required
			type        : 'richText', // required
			defaultValue: [{
				children: [{text: 'Here is some default content for this field'}],
			}],
			required    : true,
			admin       : {
				elements  : [
					'h2',
					'h3',
					'h4',
					'link',
					'upload',
				],
				leaves    : [
					"bold",
					"italic",
					"underline",
					"strikethrough",
					"code",
				],
				hideGutter: true,
				upload    : {
					collections: {
						media: {
							fields: [{
								name     : 'alt',
								label    : 'Alt text',
								type     : 'text',
								minLength: 25,
								maxLength: 255,
								required : true,
							},],
						},
					},
				},
			}
		}
	]
};


export default RichTextBlock;

Expected Behavior

the alt field should be required

Current Behavior

The alt field does not even show when adding media. Only if you click edit.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions