-
-
Notifications
You must be signed in to change notification settings - Fork 588
[6.x] Add size prop to FieldsProvider and Textarea #12513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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" |
There was a problem hiding this comment.
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)
inject: { | ||
fieldsContext: 'PublishFieldsContext', | ||
}, |
There was a problem hiding this comment.
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
.
This PR adds a
size
prop to theFieldsProvider
component, which is then passed down to the components that support it by the fieldtypes. This allows you to make an entire set of fieldssm
for example (but only for types that supportsize
).It also adds a
size
prop and variant classes to theTextarea
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.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.