Skip to content

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Sep 19, 2025

This PR adds a size prop to the FieldsProvider component, which is then passed down to the components that support it by the fieldtypes. This allows you to make an entire set of fields sm for example (but only for types that support size).

It also adds a size prop and variant classes to the Textarea component (may need some tweaking).

I did notice some inconsistency in border radius on the xs sizes. Button groups and selects are more rounded than text (and now textarea as well). Might be intentional but thought I'd mention it.

Screenshot 2025-09-19 at 17 03 52

If you're making a whole set of fields small there's probably an argument for reducing the labels and gaps between fields as well, but I'll leave that up to you. I'm using this in my Miniset addon and can always adjust things there with CSS if necessary.

@jacksleight jacksleight marked this pull request as ready for review September 22, 2025 15:16
@jackmcdade
Copy link
Member

My guess would be any weird inconsistencies come from the first place i needed a variant and just made it fit that particular case. I'll dig around and see about those borders because I'm with you — I'd much rather them be consistent as a system and override as needed.

:key="$index"
:name="name"
:read-only="isReadOnly"
:size="fieldsContext.size.value"
Copy link

Choose a reason for hiding this comment

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

Bug: Context Access Error in Fieldtype Components

Accessing fieldsContext.size.value in ButtonGroupFieldtype, ToggleFieldtype, and TextareaFieldtype without null checking causes a runtime error. If these components are used outside a FieldsProvider context, fieldsContext is undefined, leading to an error like "Cannot read properties of undefined (reading 'size')".

Additional Locations (2)

Fix in Cursor Fix in Web

inject: {
fieldsContext: 'PublishFieldsContext',
},
Copy link

Choose a reason for hiding this comment

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

Bug: Context Key Mismatch Causes Undefined Error

The inject key 'PublishFieldsContext' doesn't match the 'PublishFields' key used by the FieldsProvider when creating the context. This causes fieldsContext to be undefined, leading to runtime errors when attempting to access fieldsContext.size.value.

Additional Locations (2)

Fix in Cursor Fix in Web

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.

2 participants