duplicates #2679775: Inline labels in classy theme do not clear floats
For Classy and Classy-based themes (sub-themes of Classy), when setting a field label to 'Inline', we use 'float: left' for the .field__label class. If the content of the fields is very short, this leaves room for subsequent fields to also float up beside the inline field.
Steps to reproduce:
- Create two new fields
- Allow these fields to be multivalue
- set the labels to inline on the 'Manage Display' page
- Add one word of content to each field
- The fields will display inline to each other, rather than just their parent.
See this screenshot:

The expected behaviour would be that only the field(s) related to that label would float, like so:

If we add a 'clearfix' class to the field when it has a label set, this will fix this issue. I"ll attach a patch in the comments.
Comments
Comment #2
markconroy commentedComment #3
markconroy commentedAdding patch.
Comment #4
markconroy commentedSetting status to 'needs review'
Comment #5
markconroy commentedComment #6
teemuaro commentedBug reproduces nicely, patch applies cleanly and fixes the problem.
Comment #7
alexpott8.2.x is only open for critical fixes.
The fix seems a bit general no? I would have expected it to only add clearfix when the label is inlined.
Comment #8
markconroy commentedHi @alexpott,
It's is 'general', but at the same time if the label is not 'display inline', the clearfix won't matter. I can look at it again if you wish to only apply if the label is inline, but I think it'll result in messier looking code with {% if %} statements.
Comment #9
alexpott@markconroy see the top of the file... we are already doing stuff like this...
So we can add this to the classes variable... something like
label_display == 'inline-or-whatever-this-is' ? 'clearfix',Comment #10
markconroy commentedJust adding client to the contribution list here - their first contribution (they are new to Drupal)
Comment #11
alexpottI also wonder if we can't just add
To core/themes/classy/css/components/field.css
Comment #12
alexpottComment #13
markconroy commentedShould be fine. Patch attached.
Comment #16
kay_v commentedMarking this issue as the duplicate and pointing the effort to a more recently updated issue; note, however, that concerns raised in this issue may as yet be unaddressed in #2679775: Inline labels in classy theme do not clear floats.
Comment #17
kay_v commented