In #2675464: Margin on form-items in table rows (Classy) we identified and devised a solution for a problem in the Classy theme that causes problems for modules like IEF and Paragraphs. However, @lauriii suggested it was too dangerous to fix properly in Classy without trying first in Seven.
Problem
In /core/themes/classy/css/components/form.css we have:
tr.odd .form-item,
tr.even .form-item {
margin-top: 0;
margin-bottom: 0;
}
This works fine for single element forms (like checkboxes or selects) in table rows, but causes problems when we want to have more complex multi-element forms in tables (like anywhere in a standard node edit form when a field widget requires multiple form elements).
Furthermore, this seems to break content list styles.
Solution
Replace the above code with:
* When a table row has a single form item, prevent it from adding unnecessary
* extra spacing. If it has multiple form items, allow spacing between them
td > .form-item:only-child {
margin-top: 0;
margin-bottom: 0;
}
Todo
- Create a patch
- Post screenshots showing before/after in a complex form like paragraphs
- Post screenshots showing before/after in the content list
- Tag for Needs frontend framework manager review
- Copy issue credit across from #2675464: Margin on form-items in table rows (Classy)