Repository navigation
Add margin-bottom lint rules for TextControl - #64212
Conversation
|
Size Change: +73 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
| ) } | ||
| <InspectorControls group="advanced"> | ||
| <TextControl | ||
| __nextHasNoMarginBottom |
| <VStack spacing={ 4 }> | ||
| <TextControl | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom |
There was a problem hiding this comment.
Testing instructions
Go to the Pages view in Site Editor (wp-admin/site-editor.php?postType=page), and click the Add New Page button.
| Before | After |
|---|---|
@WordPress/gutenberg-design I'm seeing some inconsistency in the spacing before the CTA button in contexts like this. The Figma specs it as 24px — should I follow that everywhere? Also, would the spacing be different in a non-Modal context like Data Views Quick Edit, or a small block toolbar popover like the Language formatter?
There was a problem hiding this comment.
@jameskoster @mattrwalker this would be a great opportunity to fix up the modal component, bring it in sync. What's the right value?
There was a problem hiding this comment.
I think there could be a case for a dedicated ModalFooter (or similar) component that handles this. It should:
- Align the buttons (right)
- Set spacing
- Set the button order (primary always right-most)
- Limit to two buttons
- Handle small-screen behavior (make buttons full width and/or stack)
But that's probably part of a much broader update to Modal. Until we have a clear design for that I don't suppose the spacing matters too much – I'd probably just aim for what exists on trunk.
There was a problem hiding this comment.
Ok, if we don't have spec'ed values yet, I'm going to go with the path of least resistance as long as it's in the general vicinity of what's correct. In a lot of cases, that's going to be a space equidistant between all the control gaps (i.e. throw them all in a single VStack). This is going to be easier to deal with later once we decide on an official value.
| Button, | ||
| Popover, | ||
| __experimentalHStack as HStack, | ||
| __experimentalVStack as VStack, |
| return ( | ||
| <VStack spacing={ 4 }> | ||
| { visibleFields.map( ( field ) => { | ||
| return ( | ||
| <field.Edit | ||
| key={ field.id } | ||
| data={ data } | ||
| field={ field } | ||
| onChange={ onChange } | ||
| /> | ||
| ); | ||
| } ) } | ||
| </VStack> |
There was a problem hiding this comment.
Testing instructions
In Gutenberg experiments (wp-admin/admin.php?page=gutenberg-experiments), enable the "Quick Edit in DataViews" experiment. In the Site Editor, go to Pages (wp-admin/site-editor.php?postType=page) and switch to Table view.
Select a page row. Click the "Show quick edit sidebar" button.
| Before | After |
|---|---|
![]() |
These changes can also be seen in the Storybook for DataForm.
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom |
There was a problem hiding this comment.
This is the SelectControl in the Data Views Quick Edit.
| value={ value ?? '' } | ||
| onChange={ onChangeControl } | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom |
There was a problem hiding this comment.
This is the TextControl in the Data Views Quick Edit.
| <VStack as="form" onSubmit={ onSubmit } spacing={ 4 }> | ||
| <DataForm | ||
| data={ itemWithEdits } | ||
| fields={ fields } | ||
| form={ form } | ||
| onChange={ setEdits } | ||
| /> | ||
| <Button | ||
| variant="primary" | ||
| type="submit" | ||
| accessibleWhenDisabled | ||
| disabled={ isUpdateDisabled } | ||
| > | ||
| { __( 'Update' ) } | ||
| </Button> | ||
| </form> | ||
| <FlexItem> | ||
| <Button | ||
| variant="primary" | ||
| type="submit" | ||
| accessibleWhenDisabled | ||
| disabled={ isUpdateDisabled } | ||
| __next40pxDefaultSize | ||
| > | ||
| { __( 'Update' ) } | ||
| </Button> | ||
| </FlexItem> | ||
| </VStack> |
There was a problem hiding this comment.
This is the form wrapping the Data Views Quick Edit.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |

Part of #38730
What?
Adds eslint rules to prevent new instances of
TextControlto be introduced in the Gutenberg codebase without the__nextHasNoMarginBottomprop being added.Why?
These lint rules should prevent new violating usages from being added, until we are ready to officially deprecate the margins on the BaseControl-based components all at once.
Testing Instructions
See code comments.